Top
Fork me on Gitee

Vue -- element-ui el-table 选择回显

// 取出存储的id
var clueId = "1138334945442639872";
mycustomVM.$nextTick(function(){
  var storage = [];
  mycustomVM.dataTable.forEach(function(item, index) {
      if (item.clueId === clueId ) {
          storage.push(mycustomVM.dataTable[index]);
      }
  })
  mycustomVM.toggleSelection(storage);
})
toggleSelection(rows) { // table select 默认选中fn
  if (rows) {
      rows.forEach(row => {
          this.$refs.multipleTable.toggleRowSelection(row, true);
      }); 
  } else {
      this.$refs.multipleTable.clearSelection();
  }
},
posted @ 2022-08-30 17:04  lisashare  阅读(549)  评论(0编辑  收藏  举报