当前位置: 首页 > news >正文

Eltable二次封装

封装

<template> <div> <el-table :data="tableData" border stripe :header-row-style="{ background: '#F1F6FF !important', color: '#3E445', fontWeight: '500', }" > <template v-for="(item, index) in column" > <el-table-column v-if="item.slot" :align="item.align" :label="item.label" :min-width="item.minWidth" :width="item.width" :fixed="item.fixed" > <template slot-scope="scope"> <slot :name="item.slot" :row="scope.row"></slot> </template> </el-table-column> <el-table-column v-else :align="item.align" :prop="item.prop" :label="item.label" :width="item.width" :min-width="item.minWidth" ></el-table-column> </template> </el-table> <el-pagination v-if="total" background layout="total, sizes, prev, pager, next" :page-sizes="pageSizes" :page-size="pageSize" :current-page="currentPage" :total="total" class="fyDiv" @size-change="handleSize" @current-change="handlePage" ></el-pagination> </div> </template> <script> export default { props: { tableData: { type: Array, default: () => [] }, column: { type: Array, default: () => [] }, total: { type: Number, default: () => 0 }, pageSizes: { type: Array, default: () => [10, 20, 30, 40], }, pageSize: { type: Number, default: () => 10 }, currentPage: { type: Number, default: () => 1 }, }, data() { return { } }, methods: { handleSize(){ this.$emit('handleSize') }, handlePage(){ this.$emit('handlePage') }, } } </script> <style lang="scss" scoped> ::v-deep .el-table__cell{ min-height: 46px; } </style>

使用

<TablePage :column="column" :tableData="customerTable" > <template #level="scope"> {{ scope.row.level | CustomerLevelType }} </template> <template #stage="scope"> {{ scope.row.stage | CustomerStageType }} </template> <template #type="scope"> {{ scope.row.type | CustomerStageType }} </template> <template #action="scope"> <el-link type="primary" :underline="false" @click="openCustomer('edit',scope.row)" style="">按钮</el-link> <el-link type="primary" :underline="false" @click="openDetails(scope.row.id)">按钮</el-link> </template> </TablePage>

数据格式

column: [ { label: '客户ID', prop: 'number', minWidth: 150, },{ label: '客户名称', slot: 'name', minWidth: 180, },{ label: '客户级别', prop: 'levelStr', minWidth: 100, },{ label: 'POI名称', slot: 'poiName', minWidth: 150, } ]
http://www.cnnetsun.cn/news/61761.html

相关文章:

  • Happy LLM:Github爆火!手把手教你从0手搓个大模型!
  • SSM线上学习系统8e88w(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面
  • 深度解析:MindsDB与ChromaDB向量数据库集成的高效实战指南
  • 32、深入了解Samba与Linux安全策略
  • 26、调试 Shell 程序的实用方法
  • Symbolic 英文单词学习
  • AI开发全流程工具链:从编码辅助到模型部署的实战指南
  • 英语综合练习题
  • 电力物联网系统能够发挥什么作用
  • 压气站SCADA数据采集远程监控系统方案
  • 12、高级渗透测试与中间人攻击技术详解
  • Vue3 生命周期全面解析:从创建到销毁的完整指南
  • 3个让我后悔的StyleGAN2数据集错误:从失败到成功的真实经历
  • 电商数据采集 API 接口:全流程采集与分析指南(附实战代码)
  • 7、Docker 镜像构建、注册与存储全解析
  • Python语法基础笔记(四)
  • 13、找回丢失文件的实用方法
  • 14、Linux 用户与用户组管理全解析
  • 30亿参数撬动87%成本下降:ERNIE 4.5 VL重塑多模态AI产业格局
  • PaperXie AI毕业论文写作功能深度实测:从选题到成稿,一个被低估的学术效率引擎如何重塑我的研究流程
  • torchtune终极部署指南:从微调到生产环境的完整链路
  • 科研认知减负革命:书匠策AI如何将文献“噪音”转化为创新“信号”
  • SSM 还是 Spring Boot?2025 年计算机毕设选题避坑指南与 50 个优质题目推荐
  • 27、Linux与UNIX系统管理操作指南
  • Nordic经过全球认证的、多传感器、电池供电的蜂窝物联网原型平台:Thingy91X套件
  • 基于springboot + vue学生选课信息管理系统
  • 【MWORKS使用技巧73】如何在Sysplorer中将仿真数据导入Syslab进行分析与绘图?
  • 2026毕设ssm+vue基于的住房保障系统论文+程序
  • Cursor
  • 为不同的wordpress页面调用不同的顶部菜单