element表格添加單選按鈕


下面是主要代碼,項目涉及隱私就不發全部代碼了

1,首先在表格中添加如下代碼,

:label="scope.$index + 1"不加的話不會顯示出來
但是加了之后會出現數字 我用了css樣式把數字隱藏了
/deep/ .el-radio__label{
  display: none;
}

 

 

 <el-table-column  label="選擇" align="center" width="55">
          <template solt-scope="scope">
           <el-radio v-model="radio" :label="scope.$index + 1" @change.native="radioData(scope.row)"></el-radio>
          </template>
 </el-table-column>

2,在data中提供

radio: false // 單選按鈕

3,在methods里提供方法,scope就是選中的數據

radioData (scope, row) {
      this.selectData = scope
    },

  


免責聲明!

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



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