element UI 表格单击行时选中该行 checkBox

1、table上增加 @row-click="handleClickTableRow"
2、单选框的checkbox那列加上  @selection-change="handleSelectionChange"
3、table加上ref
代码实现:
methods: {
    handleClickTableRow(row, event, column) {
      console.log(row);
      console.log(column);
      this.$refs.fileTable.toggleRowSelection(row);
    },
    handleSelectionChange(rows) {
      console.log(rows);
      this.multipleSelection = rows;
    },
},

 

 

 

posted @ 2024-07-01 13:16  唏嘘-  阅读(1)  评论(0编辑  收藏  举报