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(()=>{  })      //用這個方法去刷新視圖和數據


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM