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

el-table合计放在标题上方且合并列以及渲染后端返回的数据

el-table二次封装的父组件中的属性

            <y-table :table-data="tableData" :table-model="tableModel" :isShowSummary="true" :getSummaries="getSummaries"></y-table>

el-table合计放在标题上方

<style lang="scss" scoped>
/* /deep/ 为深度操作符,可以穿透到子组件 */
::v-deep .el-table {display: flex;flex-direction: column;
}::v-deep .el-table__footer-wrapper {order: -1;
}
</style>

合并列

// 父组件创建watch监听然后写入对应的方法watch: {tableData: {immediate: true,handler() {setTimeout(() => {const tds = document.querySelectorAll('.el-table__footer .has-gutter tr>td');tds[0].colSpan = 2;tds[0].style.textAlign = 'center'tds[1].style.display = 'none'}, 0)}}},

渲染后端返回的数据

// 自定义的合计计算方法getSummaries(param) {let ylanimalgoodscost = nullconst {columns, data} = param;const sums = [];columns.forEach((column, index) => {console.log(column)if (index === 0) {sums[index] = '合计';} else {sums[index] = '';}if (column.property === 'statusTime') {sums[index] = ylanimalgoodscost == null ? this.tableData[0]?.mobile : ''}if (column.property === 'balance') {sums[index] = ylanimalgoodscost == null ? this.tableData[0]?.status :''}})return sums;},
http://www.lryc.cn/news/418113.html

相关文章:

  • magic-api相关应用与配置
  • AI大模型赋能开发者|海云安创始人谢朝海受邀在ISC.AI 2024大会就“大模型在软件开发安全领域的应用”主题发表演讲
  • 基于Kahn算法|动态线程池,支持扩展点并发执行|召回|过滤
  • Bootstrap 4 表头固定,tbody滚动条
  • MYSQL知识点(持续更新)
  • html+css网页设计 酷狗首页1个页面 (无js)
  • 用户体验至上:9款软件界面设计工具分享
  • Lambda 表达式:解锁编程世界的魔法之门
  • 【python】Pandas处理Excel表格用法分析与最佳实践
  • KL 散度(python+nlp)
  • 四种推荐算法——Embedding+MLP、WideDeep、DeepFM、NeuralCF
  • 鹏鼎控股:最新面试求职SHL逻辑测评笔试题库讲解及真题分享
  • 【Git】git 不跟踪和gitignore区别
  • 51单片机—智能垃圾桶(定时器)
  • 熵权法模型(评价类问题)
  • 用uniapp 及socket.io做一个简单聊天app 踢人拉黑 7
  • springboot项目迁移到阿里云函数
  • Java设计模式(桥接模式)
  • 【独家原创】基于APO-Transformer-LSTM多特征分类预测(多输入单输出)Matlab代码
  • 【大模型】大模型指令微调的“Prompt”模板
  • Spring的设计模式----工厂模式及对象代理
  • 【算法】浅析广度优先搜索算法
  • 分布式时序数据库TimeLyre 9.2发布:原生多模态、高性能计算、极速时序回放分析
  • PMP考试题库每日五题+答案解析
  • 机器学习用python还是R,哪个更好?
  • 【数据结构】mapset详解
  • 数据结构(邓俊辉)学习笔记】词典 02—— 散列函数
  • Python学习(1):使用Python的Dask库实现并行计算
  • 数据结构 - 哈希表
  • 电商选品这几点没做好,等于放弃80%的流量!