最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
element带选择表格将表头的复选框改成文字的实现代码
时间:2022-06-25 14:05:56 编辑:袖梨 来源:一聚教程网
本篇文章小编给大家分享一下element带选择表格将表头的复选框改成文字的实现代码,代码介绍的很详细,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。
方法一:使用表格属性:header-cell-class-name 表格界面代码
css;">{{ scope.row.date }}
对应js
data() {
return {
tableData: [{
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}],
multipleSelection: []
}
},
methods: {
cellclass(row){
if(row.columnIndex===0){
return 'DisabledSelection'
}
}
}
对应CSS
.el-table /deep/.DisabledSelection .cell .el-checkbox__inner{
display:none;
position:relative;
}
.el-table /deep/.DisabledSelection .cell:before{
content:"选择";
position:absolute;
right 11px;
}
/deep/的作用:如果你使用了别人的组件或者自己开发一个组件,有时候你修改一处就可能影响到别的地方,这个时候要么你不用别人的组件,自己重新封装一个,但很多时候是不太现实的,所以就需要使用/deep/,既不影响到别的地方,又能修改子组件在当前的样式。
方法二、使用表格列标题属性:label-class-name
界面代码
{{ scope.row.date }}
对应CSS
.el-table /deep/.DisabledSelection .cell .el-checkbox__inner{
display:none;
position:relative;
}
.el-table /deep/.DisabledSelection .cell:before{
content:"选择";
position:absolute;
right 11px;
}
方法三:使用document.querySelector() 界面代码
{{ scope.row.date }}
对应js
mounted(){
this.$nextTick(()=>{
this.init();
})
},
methods: {
init(){
document.querySelector(".el-checkbox__inner").style.display="none";
document.querySelector(".cell").innerHTML = '选择'
}
}
方法四:不使用selection选择列,重写列使用checkbox
方法五:直接通过CSS样式修改
.el-table__header .el-table-column--selection .cell .el-checkbox {
display:none
}
.el-table__header .el-table-column--selection .cell:before {
content: "选择";
}
相关文章
- 精灵宝可梦 出发吧 皮卡丘 玩家锦标赛冠军因庆祝胜利被取消资格 04-07
- 国产恐怖游戏神作将登Switch 民俗灵异氛围拉满 04-07
- 破甲流阵容推荐 横扫千军的终极搭配 04-07
- 索尼经典大作主角“回归” 遭曝光后火速换脸 04-07
- 抖币充值入口官网-抖音1:10抖币超值充值链接 04-07
- 苍鹭与棒球小猪的协同战斗艺术 04-07
