将el-table checkbox 多选改为单选

{{ tag.name }}

 async selectChange(selection, row) {
      // 清空
      await this.$refs.table.clearSelection();
      if (selection.length === 0) return;
      this.$refs.table.toggleRowSelectionInfo(row, true);
      this.selected = [];
      this.selected.push(row);
    },
    async selectionChange(selected) {
      if (selected.length > 1) {
        await this.$refs.table.clearSelection();
        const newRows = selected.filter((it, index) => {
          if (index == selected.length - 1) {
            this.$refs.table.toggleRowSelectionInfo(it, true);
            return true;
          } else {
            this.$refs.table.toggleRowSelectionInfo(it, false);
            return false;
          }
        });
        this.selected = newRows;
      } else {
        this.selected = selected;
      }
    },

你可能感兴趣的:(vue.js,javascript,ecmascript)