更新时间:2020-07-24 00:37:54
更新说明:修复输入框的值验证,对于非正整数,值清空,并在失焦时,值设为0。
代码修改地方:
1  | <input type="text" class="num-input" v-model="item.pro_num"> | 
处新增两个判断
1  | @input="search($event,index)" @blur="check($event,index)", | 
即
1  | <input type="text" class="num-input" v-model="item.pro_num" @input="search($event,index)" @blur="check($event,index)"> | 
对应methods加两个函数:
1 2 3 4 5 6 7 8 9 10 11 12  | search: function(event, index) {        search: function(event, index) {            let flag = new RegExp("^[1-9]([0-9])*$").test(event.target.value);            if (!flag) {                this.productList[index].pro_num = '';            }        },        check: function(event, index) {            if (event.target.value == '') {                this.productList[index].pro_num = 0;            }        }, | 
更新时间:2020-07-15 22:47:06
特别申明:
			本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
			本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
			如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com