• el-input 视图不刷新或者视图刷寻之后值没有更新


    背景:

    el-table表格循环的数据,本次发货数量不能大于剩余数量,如果大于剩余数量就默认变为剩余数量

    HTML代码:

          <el-table-column prop="skuDeliveryNum" align="center" label="本次发货数量" min-width="110">
                                <template slot-scope="scope">
                                    <el-input maxlength="50" v-model="scope.row.skuDeliveryNum" placeholder="请输入" :max="scope.row.skuLeftNum"
                                        @blur="changeNun(scope.row)"
                                        @input="scope.row.skuDeliveryNum = scope.row.skuDeliveryNum.replace(/[^0-9]/g, '');">  
                                    </el-input>
                                </template>
                            </el-table-column>
    @input="scope.row.skuDeliveryNum = scope.row.skuDeliveryNum.replace(/[^0-9]/g, '');">   不允许输入数字以外的字符
    //发货数量判断
                changeNun(num) {
                    if (event.target.value > num.skuLeftNum) {
                        this.$nextTick(()=>{
                            num.skuDeliveryNum = num.skuLeftNum
                        })
                        this.$message.error('发货数量不能大于剩余数量');
                    } else if (event.target.value == '' || event.target.value == null) {
                        this.$nextTick(()=>{
                            num.skuDeliveryNum = 1
                        })
                    }
                },
     
      this.$nextTick(()=>{  })      //用这个方法去刷新视图和数据
  • 相关阅读:
    linux学习 建立静态库,动态库,写简单的makefile
    C++中顶层const和底层const
    BDB (Berkeley DB)数据库简单介绍(转载)
    Java中Map的使用
    Spring MVC 3 深入总结
    nvl,空时的推断和取值
    java堆栈 (转)
    mybatis--面向接口编程
    HDU 4888
    socket编程——一个简单的样例
  • 原文地址:https://www.cnblogs.com/lidonglin/p/14119945.html
Copyright © 2020-2023  润新知