vue中input校验只能输入正数、小数点保留两位或者多位
<el-inputv-model="form.theoProportions[item].theoProportion"@keyup.native="proving(form.theoProportions[item].theoProportion,item)" placeholder="请输入用量"></el-input>proving(params,item){this
·
<el-input v-model="form.theoProportions[item].theoProportion" @keyup.native="proving(form.theoProportions[item].theoProportion,item)" placeholder="请输入用量"></el-input>
proving (params, item) {
this.form.theoProportions[item].theoProportion = params.match(/\d+(\.\d{0,2})?/) ? params.match(/\d+(\.\d{0,2})?/)[0] : '';
}
更多推荐
已为社区贡献4条内容
所有评论(0)