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

iview 老版本合并单元格

新版的iview中已经支持了合并单元格了,我的版本比较老,为:"iview": "^3.5.2"。暂不支持。记录一下别的大佬的方法。感觉思路比较活,正在这种思路需要在解决问题的过程中学习。

核心思路:通过render方法,加上设置样式实现看似合并单元格。
代码如下:

data数据

dataList = [{index: '1',indexName: 'a',rate: '35%',standard: '描述11111',list: [{ info: "规则1", score: "100" },{ info: "规则2", score: "80" },{ info: "规则3", score: "60" },{ info: "规则4", score: "40" },]},{index: '2',indexName: 'b)',rate: '30%',standard: '描述2222'',list: [{ info: "规则1", score: "100" },{ info: "规则2", score: "80" },{ info: "规则3", score: "60" },{ info: "规则4", score: "40" },] }, ]

列的数据,在此数据中通过render来控制

    columns: any[] = [{title: '序号',key: 'index'},{title: '指标',key: 'indexName'},{title: '权重',key: 'rate'},{title: '评分标准',key: 'standard'},{title: '详情',key: 'list',width: 250,render: (h, params) => { return h('div', {attrs: {class: 'subCol'},}, [h('ul', params.row.list.map(item => {return h('li', {}, item.info)}))])}},{title: '分值',key: 'list',width: 100,render: (h, params) => {  return h('div', {attrs: {class: 'subCol'},}, [h('ul', params.row.list.map(item => {return h('li', {}, item.score)}))])}}, ] 

组件代码

<Table :columns="columns" :data="dataList"  :loading="loading" border></Table>

css

.subCol>ul>li {margin: 0 -18px;list-style: none;text-Align: center;padding: 9px;border-bottom: 1px solid #ccc;overflow-x: hidden;
}.subCol>ul>li:last-child {border-bottom: none
}

实现效果


image.png

参考网站:
https://blog.csdn.net/weixin_34138139/article/details/88600460



喜欢的朋友记得点赞、收藏、关注哦!!!

相关文章:

  • Javase 基础加强 —— 03 集合
  • nt!MiSessionAddProcess函数分析和nt!MmSessionSpace全局变量的关系
  • 基于注解脱敏+链路追踪traceId 快速定位错误
  • VSCode常用插件推荐
  • 普通IT的股票交易成长史--20250504实盘记录
  • 什么是unordered_map?用大白话说
  • GitLab CI/CD变量使用完全指南
  • 《奇迹世界起源》:宝箱工坊介绍!
  • 2025-04-26-利用奇异值重构矩阵-美团
  • 日本人工智能发展全景观察:从技术革新到社会重构的深度解析
  • 研0大模型学习(第11天)
  • AUTOSAR图解==>AUTOSAR_SWS_V2XManagement
  • Y1模拟一 补题报告
  • Electron 从零开始:构建你的第一个桌面应用
  • 状态值函数与状态-动作值函数
  • SQL手工注入(DVWA)
  • n8n 构建一个 ReAct AI Agent 示例
  • Dify 完全指南(一):从零搭建开源大模型应用平台(Ollama/VLLM本地模型接入实战)》
  • QT聊天项目DAY07
  • MPI,Pthreads和OpenMP等并行实验环境配置
  • 中国海警局回应日本民用飞机侵闯我钓鱼岛领空:依法警告驱离
  • 日产淡水10万吨、全自动运行,万华化学蓬莱海水淡化厂投产
  • 跳水世界杯总决赛:程子龙/朱子锋夺男子双人10米台冠军
  • 五一当天1372对新人在沪喜结连理,涉外婚姻登记全市铺开
  • 李在明回应韩国大法院判决:与自己所想截然不同,将顺从民意
  • 乌美签署矿产协议