el-table 全选不可选择(2)

<template>
<div>
  <el-button @click="btnClick">点击</el-button>
  <table>
	<!--<span v-for="(item,index) in nStr">-->
      <tr v-for="(item,index) in nStr">
        <td> <el-checkbox :key="index" @change="cChange(index)" :disabled="strSelect.indexOf(item.name) > -1"></el-checkbox></td>
        <td>{{index}}</td>
        <td>{{item.name}}</td>
      </tr>
	<!--</span>-->
  </table>

<!--  <table>-->
<!--    <tr>-->
<!--      <td>1</td>-->
<!--      <td>11</td>-->
<!--    </tr>-->
<!--    <tr>-->
<!--      <td>2</td>-->
<!--      <td>22</td>-->
<!--    </tr>-->
<!--    <tr>-->
<!--      <td>3</td>-->
<!--      <td>33</td>-->
<!--    </tr>-->
<!--  </table>-->
</div>
</template>

<script>
export default {
  data(){
    return{
      nStr:[{name:"吉林",state:false },{name:"长春",state:false},
        {name:"松原",state:false},{name:"白城",state:false},{name:"白山",state:false}],
      nList:['1a','2b'],
      riRate:[],
      strSelect : "吉林,白城"
    }
  },
  methods:{
    btnClick(){
      console.log(this.nStr);
    },
    cChange(index){
      // console.log(vm)
      this.nStr[index].state = !this.nStr[index].state;
    }
  }
}
</script>
posted @ 2021-08-17 09:36  寒冷的雨呢  阅读(382)  评论(0编辑  收藏  举报