vue element-ui 点击表格当前行radio单选选中


current-change:点击单选按钮时触发,返回的参数currentRow, oldCurrentRow
row-dblclick: 当某一行被双击时会触发该事件,返回的参数row, column, event

 

<el-table :data="tableData"
 border
 highlight-current-row
 @current-change="handleSelectionChange"
 @row-click="chooseone"
>
  <el-table-column width="55">
    <template slot-scope="scope">
      <el-radio v-model="radioId" :label="scope.row.id">
        <span class="el-radio__label"></span>
      </el-radio>
    </template>
  </el-table-column>
</el-table>
  data() {
    return {
      tableData: [], //表格数据
      radioId: null, //单选框绑定的值
      currentSelectItem: {} //当前选中的行数据
    }  
  }
methods: {
    handleSelectionChange(row) {
      this.currentSelectItem = row
      this.radioId = row.id
    },
    chooseone(row){
      this.currentSelectItem = row
      this.radioId = row.id
    }
  }

 

 

posted @ 2021-11-26 16:44  君君仔的随笔  阅读(1852)  评论(0)    收藏  举报