全局样式
/* 取消[type='number']的input的上下箭头 */ input::-webkit-inner-spin-button { -webkit-appearance: none !important; } input::-webkit-outer-spin-button { -webkit-appearance: none !important; } input[type="number"] { -moz-appearance: textfield; }
限制鼠标滚动改变数字
<el-input type="number" v-model="form.changeMoneyWt" placeholder="请输入签证金额" maxlength="13" @mousewheel.native.prevent @DOMMouseScroll.native.prevent> <template slot="append">元</template> </el-input>
校验
export const validateMoneyNoVoid = (rule, value, callback) => { if (value === "" || value === undefined) { return callback(); } const reg = /^-?\d+(\.\d{1,2})?$/; if (!reg.test(value)) { return callback(new Error("最多两位小数!")); } callback(); };
标签:number,value,callback,webkit,input,type From: https://www.cnblogs.com/wjian0916/p/17828485.html