里的數據已經修改了,但是頁面不更新


問題:使用<el-table>里的文本框賦值后,table里是數據不更新

解決:

 // 頁面不更新的解決: 數據轉化以下,僅以下兩行!!!!!!
        let dataArrTemp = JSON.stringify(this.form.product_bom);
        this.form.product_bom= JSON.parse(dataArrTemp);

 

以下自用的

html部分:
<el-table-column label="分類" min-width="120">
  <template slot-scope="scope">
    <span v-if="scope.row.name">{{scope.row.name}}</span>
    <el-input
      v-else
      v-model="scope.row.name"
      :disabled="disabled"
      class="pointer"
      @focus="handleMaterielDialogs(scope.row, scope.$index)"
      suffix-icon="el-icon-zoom-in"
    ></el-input>
  </template>
</el-table-column>

js:部分

        // 獲取到index
        handleMaterielDialogs(row, index) {
              this.thatRowIndex = index;
        },

        // 值帶頁面上
        this.form.bom[this.thatRowIndex] = Object.assign(
          {},
          this.activeList3[0],
          { count: this.form.bom[this.thatRowIndex].count * 1 }
        );


        // 頁面不更新的解決: 數據轉化以下,僅以下兩行!!!!!!
        let dataArrTemp = JSON.stringify(this.form.bom);
        this.form.bom= JSON.parse(dataArrTemp);                
View Code

 


免責聲明!

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



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