vue.js element el |
您所在的位置:网站首页 › 两列数值比较大小 › vue.js element el |
场景,换购价不能超过售价。网上搜到的一般都是用form对内容进行简单校验,比如不为空,长度等,不能进行数据比较之类的操作。 其中 @blur="onExchangeChange(scope.$index)"是失焦后进行数据检查,参数为行数 vue.js代码,通过index获取到售价,换购价,然后进行比较,如果换购价大于售价,则提示,并把换购价初始化为售价。 onExchangeChange: function (index) { console.log("exchange price change"); let tmpObj = this.tableData[index]; let salePrice = parseFloat(tmpObj.price); let totalAmount = parseFloat(tmpObj.totalAmount); if (totalAmount > salePrice) { layer.msg('换购价不能大于售价', {time: 1000}) this.tableData[index].totalAmount = salePrice; this.$set(this.curHomePageExchangeGoodsList, index, tmpObj); } },其中这句代码是对表进行行更新, homePageShopTable 是表格的ref this.$set(this.curHomePageExchangeGoodsList, index, tmpObj); |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |