赞
踩
方法一:el-input “type=number“ 隐藏上下箭头
/deep/ input::-webkit-inner-spin-button {
-webkit-appearance: none !important;
}
/deep/ input[type='number'] {
-moz-appearance: textfield !important;
}
方法二:事件控制(兼容)
1.只允许输入整数或小数只保留小数点后两位
<el-input size="small"
onkeyup="this.value=this.value.match(/\d+\.?\d{0,2}/)"
onafterpaste="this.value=this.value.match(/\d+\.?\d{0,2}/)"
v-model="scope.row.abc"
maxlength="9"></el-input>
2.只允许输入整数
<el-input size="small"
onkeyup="this.value=this.value.replace(/\D/g,'')"
onafterpaste="this.value=this.value.replace(/\D/g,'')"
v-model.number="scope.row.def"
maxlength="9"></el-input>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。