The problem of invalid click in el-table-column of el-Switch in elementUI

When writing the project, I found that even if v-model is bound, the switch will not take effect. The following method can solve it

<el-table-column>
       <!-- slot-scope="scope" 用来解决不生效的问题 -->
<!-- scope.row.show 这里的 row 指的是 table绑定的data的数据 -->
          <template slot-scope="scope">
            <el-switch
            @click="isShow"
              v-model="scope.row.show"
              active-color="#13ce66"
              inactive-color="#DCDFE6"
              :active-value="true"
              :inactive-value="false"
            >
        <!-- :active-value="true"  选中赋值为 true -->
        <!-- :inactive-value="false"  不选中赋值为false -->
            </el-switch>
          </template>
</el-table-column>
 list: [
        {
          time: "8:00-9:00",
          show: true
        },
        {
          time: "9:00-10:00",
          show: false
        },
        {
          time: "10:00-11:00",
          show: false
        },
      ],

Guess you like

Origin blog.csdn.net/lolhuxiaotian/article/details/123717044