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
    }
  }

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM