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