代码:

      <el-table
        ref="multipleTable"
        :data="gridData"
        tooltip-effect="dark"
        style="width: 100%"
        @selection-change="handleSelectionChange"
      >
        <el-table-column
          type="selection"
          style="margin-left: 10px"
        />
      </el-table>


    handleSelectionChange(val) {
      this.$forceUpdate()
      const newValue = JSON.parse(JSON.stringify(val))
      this.multipleSelection = newValue
      for (let i = 0; i < this.multipleSelection.length; i++) {
        this.multipleSelection[i].database = this.selectMultipleValue[this.multipleSelection[i].businessLine + this.multipleSelection[i].sourceType]
      }
      this.$forceUpdate()
    },

注意:        

        handleSelectionChange这个方法的参数val,指的是原本的数据,一定要注意要深拷贝,不然这里直接修改val,原本的下拉菜单的值就没有了
Logo

前往低代码交流专区

更多推荐