news 2026/7/7 18:24:48

Eltable二次封装

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
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, } ]
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/7/7 19:42:55

Apache Shiro 教程

Apache Shiro 完整教程 &#x1f4da; 教程目标&#xff1a;通过理论学习和代码实践&#xff0c;全面掌握Apache Shiro的核心功能、架构设计和最佳实践&#xff0c;能够在实际项目中灵活应用Shiro实现安全认证和授权。 &#x1f4d6; 学习路径导航 章节结构 第一章&#xff1…

作者头像 李华
网站建设 2026/7/7 10:53:43

每个人都能学会的大模型教程!(附文档资料)

大模型的入门难度会比机器学习和深度学习模型结构更加复杂&#xff0c;入门门槛更高&#xff0c;但是如果能找到一个合适的教程&#xff0c;会让你少走弯路如果你以后想要从事算法工程师相关岗位或者科研上准备做大模型相关的内容&#xff0c;这个教程真的适合你&#xff0c;直…

作者头像 李华
网站建设 2026/7/7 8:47:21

17、OS X 多任务处理全攻略

OS X 多任务处理全攻略 1. 多任务处理概述 OS X 具备强大的多任务处理能力,它能快速地在运行的应用程序和系统进程之间分配处理器时间,让用户感觉所有任务都在同时运行。当新应用启动、进程开启,或者其他进程闲置甚至完全关闭时,系统会实时监控这些任务,并动态分配内存和…

作者头像 李华
网站建设 2026/7/7 16:01:03

会议总结成难题?基于亚马逊云科技的AI会议神器来帮您!

AI不仅改变了构建内容&#xff0c;而且还在变革构建方式。当下开发者正在见证一个关键转折&#xff1a;AI正在自动化重复性任务&#xff0c;从而使开发者能够更加专注于创新和创造。日常生活中的一个鲜明例子就是会议。会议对于协作至关重要&#xff0c;但它们往往会产生冗长的…

作者头像 李华
网站建设 2026/7/6 23:52:19

21、Unix 实用指南:从文档查询到系统定制

Unix 实用指南:从文档查询到系统定制 1. 命令手册问题排查 当使用 man 命令查询命令手册却提示无手册条目时,可从以下方面排查: - 命令归属 :部分命令并非独立的 Unix 程序,而是 shell 的一部分。在 OS X 系统中,可在 bash 手册页或 builtin 手册页查找这些命…

作者头像 李华
网站建设 2026/7/5 16:11:19

采用分离加载文件的方式实现静态免杀,从而降低静态检测风险

工具介绍 RemoteShellcode采用分离加载文件的方式实现静态免杀&#xff0c;从而降低静态检测风险 工具使用 通过命令生成一段弹计算器的shellcode msfvenom -p windows/x64/exec cmdcalc.exe -f python接着用EncryptedShellcode.py进行xor的加密再把结果转换为十六进制 a8 20 e…

作者头像 李华