ElementUI表格表头自定义添加checkbox,点击选中样式不生效

场景:需要自定义table的多选效果,不用其自带的,采用官方文档此处(如图)的处理过程,并把全选控件嵌入table的表头,el-checkbox在table表头勾选样式不生效。

具体用法,点击全选,样式没有变化

javascript 复制代码
<el-table-column align="center" prop="enable" width="55">
  <template slot="header" >
    <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange"></el-checkbox>
  </template>
  <template slot-scope="scope">
    <el-checkbox v-model="scope.row.enable" true-label="1" false-label="0"
      @change="handleCheckboxChange(scope.row)"></el-checkbox>
  </template>
</el-table-column>

改进方法加入slot-scope="scope",改进后:

javascript 复制代码
<template slot="header" slot-scope="scope">
  <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange"></el-checkbox>
</template>
相关推荐
星斗大森林8 小时前
Flame游戏开发——噪声合成、域变换与阈值/调色映射的工程化实践(2)
前端
用户31506327304878 小时前
使用 vue-virtual-scroller 实现高性能传输列表功能总结
javascript·vue.js
星斗大森林8 小时前
flame游戏开发——地图拖拽与轻点判定(3)
前端
samonyu8 小时前
fnm 简介及使用
前端·node.js
bug_kada8 小时前
玩转Flex布局:看完这篇你也是布局高手!
前端
前端小巷子8 小时前
JS打造“九宫格抽奖”
前端·javascript·面试
潘小安8 小时前
『译』资深前端开发者如何看待React架构
前端·react.js·面试
李昊哲小课9 小时前
HTML 完整教程与实践
前端·html
GISer_Jing9 小时前
React 18的createRoot与render全面对比
前端·react.js·前端框架
我叫汪枫9 小时前
React Hooks原理深度解析与高级应用模式
前端·react.js·前端框架