news 2026/4/15 21:40:29

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/4/14 2:17:19

零基础跟我学做AI Agent(第1课:环境安装)

从今天开始&#xff0c;作者介绍一系列AI Agent&#xff08;智能体&#xff09;的开发或部署。需要的基础只是要对Python有个大概的了解&#xff0c;几乎是从0开始实践。涉及到的代码都会比较简单&#xff0c;一般不会超过50行。 一、Agent简介 AI Agent简称Agent&#xff0c;以…

作者头像 李华
网站建设 2026/4/15 18:38:40

2026年6大房产中介系统评测

在房产中介行业数字化转型加速的背景下&#xff0c;选择一款适配自身业务的管理系统成为提升运营效率、降低成本的关键。目前市场上的房产中介系统种类繁多&#xff0c;功能侧重点各有不同&#xff0c;让不少中介从业者难以抉择。本次评测聚焦6款主流房产中介系统&#xff0c;从…

作者头像 李华
网站建设 2026/4/14 12:38:13

12、Unix 文件管理全攻略

Unix 文件管理全攻略 1. 文件复制 在使用 cp 命令复制文件时,要特别注意路径名的准确性。如果使用 cp -R 时给出错误的路径名,可能会导致将目录树复制到自身,程序会一直运行直到文件系统被填满。 cp 命令复制文件时,新文件的所有权会变更为执行 cp 命令的用户。若…

作者头像 李华
网站建设 2026/4/14 21:06:48

13、在Unix系统中查找文件和信息的实用方法

在Unix系统中查找文件和信息的实用方法 在现代计算机的使用过程中,随着存储系统的不断增大,查找文件和信息成为了一项基本挑战。无论是文件和目录管理得井井有条、使用便于记忆的名称,还是存在大量随意命名的文件和目录,总会有需要根据文件内容、文件名或其他属性来查找文…

作者头像 李华
网站建设 2026/4/15 12:16:04

14、深入探索文件查找:从 `find` 到 Spotlight

深入探索文件查找:从 find 到 Spotlight 在操作系统中,高效地查找文件是一项重要的技能。本文将详细介绍 find 命令的使用方法,包括根据文件名、文件大小、权限和修改时间等条件进行查找,还会介绍 find 的好搭档 xargs 以及 Mac OS X 中的 Spotlight 功能。 1. …

作者头像 李华