踩坑记录1 --- table多选 根据返回数据默认选中

 toggleSelection (rows) {
      debugger
      if (rows) {
        rows.forEach(row => {
          console.log(row);
          if (row.greant === 1) {
            // 不加$nextTick方法 通过点击事件可以调用, 在方法中无法调用
            this.$nextTick(() => {
              this.$refs.multipleTable.toggleRowSelection(row, true);
            })
          }
        });
      }
    },

不通过点击事件调用默认选中方法时 一定要加  this.$nextTick,  不加时无法进行选中

posted @ 2020-06-15 19:17  咪呼呼  阅读(297)  评论(0)    收藏  举报