明霞山资源网 Design By www.htccd.com
本文实例为大家分享了vue el-table实现自定义表头的具体代码,供大家参考,具体内容如下
el-table可以通过设置 Scoped slot 来实现自定义表头。
文档说明如下:
代码实现:
<template>
<el-dialog
width="50%"
:visible.sync="isShow"
:before-close="beforeClose"
title="自定义设备类型属性">
<div class="dialogDiv">
<el-table
:data="tableData.filter(data => handleAdd || data.name.toLowerCase().includes(handleAdd.toLowerCase()))"
style="width: 100%" border>
<el-table-column prop="code"
:label="$t('basicData.device.propDlg.code')">
</el-table-column>
<el-table-column prop="maxValue"
:label="$t('basicData.device.propDlg.maxValue')">
</el-table-column>
<el-table-column prop="minValue"
:label="$t('basicData.device.propDlg.minValue')">
</el-table-column>
<el-table-column prop="name"
:label="$t('basicData.device.propDlg.name')">
</el-table-column>
<el-table-column prop="valueType"
:label="$t('basicData.device.propDlg.valueType')">
</el-table-column>
<el-table-column prop="warning"
:label="$t('basicData.device.propDlg.warning')">
</el-table-column>
<el-table-column align="center" width="160px">
<template slot="header" slot-scope="scope">
<el-button v-model="handleAdd"
size="mini"
type="success"
circle plain
icon="el-icon-plus"
@click="handleAdd(scope.$index, scope.row)">
</el-button>
</template>
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
circle plain
icon="el-icon-edit"
@click="handleEdit(scope.$index, scope.row)">
</el-button>
<el-button
size="mini"
type="danger"
circle plain
icon="el-icon-delete"
@click="handleDelete(scope.$index, scope.row)">
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<span slot="footer">
<el-button @click="cancel">{{ $t('common.cancel') }}</el-button>
<el-button @click="confirm" type="primary">{{ $t('common.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data() {
return {
tableData: []
}
},
methods: {
// 添加
handleAdd() {
},
// 编辑
handleEdit(index, row) {
},
// 删除
handleDelete(index, row) {
},
cancel() {
this.$emit("cancel")
},
confirm() {
this.$emit("confirm", this.tableData)
}
}
};
</script>
<style lang="scss" scoped>
.dialogDiv {
height: 300px;
overflow: auto;
}
</style>
页面效果如下:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
明霞山资源网 Design By www.htccd.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
明霞山资源网 Design By www.htccd.com
暂无评论...
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。

