<el-input v-model.trim="adminInfo.hrFloor" @keyup.native="keyup('hrFloor')" @afterpaste="afterpaste('hrFloor')" placeholder="请填写层高"></el-input>
keyup(data) {
if (this.adminInfo[data].length == 1) {
this.adminInfo[data] = this.adminInfo[data].replace(/[^1-9]/g, "");
} else {
this.adminInfo[data] = this.adminInfo[data].replace(/\D/g, "");
}
},
afterpaste(data) {
if (this.adminInfo[data].length == 1) {
this.adminInfo[data] = this.adminInfo[data].replace(/[^1-9]/g, "");
} else {
this.adminInfo[data] = this.adminInfo[data].replace(/\D/g, "");
}
},
`
vue实现输入框为正整数elementUI input
最新推荐文章于 2024-05-23 14:27:35 发布