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

buildadmin 自定义单元格渲染

场景一:数据单列集中展示

例如,收购人信息有很多列,容易导致横向很长,所以需要到单列集中展示。

官方推荐使用slot渲染

在这里插入图片描述
代码示例:

// template中编写需要展示的插槽内容HTML
<template><Table ref="tableRef"><template #acquirerInfo><el-table-column label="收购人信息" :width="300"><template #default="scope"><div class="data-info"><p class="data-item">收购点:{{ scope.row['acquirer']['acquisition_name'] }}</p><p class="data-item">持卡人:{{ scope.row['acquirer']['username'] }}</p><p class="data-item">手机号:{{ scope.row['acquirer']['mobile'] }}</p><p class="data-item">身份证:{{ maskNumber(scope.row['acquirerRealname']['id_number']) }}</p></div></template></el-table-column></template><template #farmerInfo><el-table-column label="收款人信息" :width="300"><template #default="scope"><div class="data-info"><p class="data-item">收款人:{{ scope.row['farmer']['username'] }}</p><p class="data-item">身份证:{{ scope.row['acquirer']['username'] }}</p><p class="data-item">手机号:{{ scope.row['acquirer']['mobile'] }}</p><p class="data-item">身份证:{{ maskNumber(scope.row['acquirerRealname']['id_number']) }}</p><p class="data-item">银行卡:{{ maskNumber(scope.row['bank_no']) }}</p></div></template></el-table-column></template></Table>
</template>// column 字段中新增
{label: t('order.acquirer_info'),prop: 'acquirer.acquirer_info',align: 'center',operatorPlaceholder: t('Fuzzy query'),operator: false,width: 170,render: 'slot',slotName: 'acquirerInfo'
},// 样式设置 
<style scoped>
.data-info {font-family: 'Arial', sans-serif; /* 设置字体 */background-color: #f9f9f9; /* 背景色 */padding: 12px; /* 内边距 */border-radius: 6px; /* 边框圆角 */box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 阴影效果 */
}.data-item {margin-bottom: 8px; /* 每行之间的间距 */color: #333; /* 文本颜色 */font-size: 14px; /* 字体大小 */
}.data-label {font-weight: bold; /* 标签字体加粗 */color: #0a74da; /* 标签字体颜色 */
}.data-info p:last-child {margin-bottom: 0; /* 最后一行不加底部间距 */
}.el-table .cell {padding: 0; /* 去掉单元格的默认间距 */
}.el-table-column {padding-left: 10px;padding-right: 10px;
}/* 鼠标悬停效果 */
.el-table__row:hover {background-color: #f0f8ff; /* 悬停背景色 */
}.el-table__cell {padding: 12px; /* 单元格内间距 */
}/* 为表格头部设置样式 */
.el-table th {background-color: #e6f7ff; /* 表头背景色 */font-weight: bold; /* 表头字体加粗 */color: #555; /* 表头文字颜色 */text-align: center; /* 表头文字居中 */
}
</style>
http://www.xdnf.cn/news/69985.html

相关文章:

  • 【STM32单片机】#10.5 串口数据包
  • 在线打开查看cad免费工具dwg, dxf格式工具网站
  • 14.电容的高频特性在EMC设计中的应用
  • Novartis诺华制药社招入职综合能力测评真题SHL题库考什么?
  • 抱佛脚之学SSM三
  • Anaconda Prompt 切换工作路径的方法
  • RNA Club | CRISPR-Cas 免疫系统的作用原理及其与噬菌体的对抗-王艳丽教授讲座笔记
  • Activity之间交互
  • unity动态骨骼架设+常用参数分享(包含部分穿模解决方案)
  • 22. git show
  • MyBatis-Plus 实战:优雅处理 JSON 字段映射(以 JSONArray 为例)
  • 12个领域近120个典型案例:2024年“数据要素X”大赛典型案例集(附下载)
  • 网络编程4
  • L1-106 偷感好重 - java
  • vision transformer图像分类模型结构介绍
  • 运维:概念、模式与硬件基础
  • 【MySQL】详细介绍(两万字)
  • 反射内存网技术应用于数控系统
  • Shell脚本-四则运算符号
  • 软件测试入门知识详解
  • 使用Unity Cache Server提高效率
  • 二分查找、分块查找、冒泡排序、选择排序、插入排序、快速排序
  • Maven编译打包
  • MySQL的ACID特性
  • 抽象类的特点
  • 面经-浏览器/网络/HTML/CSS
  • 单页面应用的特点,什么是路由,VueRouter的下载,安装和使用,路由的封装抽离,声明式导航的介绍和使用
  • 数据结构之二叉树
  • 线性回归之多项式升维
  • TDengine 存储引擎设计