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

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



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

http://www.xdnf.cn/news/3843.html

相关文章:

  • 基于Hive + Spark离线数仓大数据实战项目(视频+课件+代码+资料+笔记)
  • Linux环境部署iview-admin项目
  • gitblit安装教程,搭建一个属于自己的Git版本仓库
  • Python读取comsol仿真导出数据并绘图
  • 【操作系统】哲学家进餐问题
  • 【前缀和】和为 K 的连续子数组
  • 软件检测价格受多种因素影响,你了解多少?
  • 【SAP】FISL的应用
  • 2023华为od机试C卷【跳格子3】
  • 高维亚空间超频物质变压缩技术 第27次CCF-CSP计算机软件能力认证
  • 《应用开发突围指南:敏捷开发的实战精髓》
  • 2001-2021年各城市平均风速数据(可作工具变量)
  • INP指标
  • 【C++贪心 图论】P7903兜心の顶|普及
  • 【算法刷题笔记day one】滑动窗口(定长基础版)
  • Java 反序列化
  • Mybatisplus:一些常用功能
  • ReentrantLock
  • C语言-回调函数
  • 大客户销售大客户营销50个常见概念及其英文表达。AI大客户销售B2B大客户营销关键概念集合
  • 全参数解读Qwen 3 系列模型 + 本地部署实操 + 多维度能力深度测评
  • 计算机总线系统入门:理解数据传输的核心
  • 动态功耗与静态功耗
  • 从零开始理解 C++ 后端编程中的分布式系统
  • Runnable组件重试机制降低程序错误率
  • 深度解析ComfyUI的使用
  • Linux常用命令29——delgroup删除组
  • Spring IoC 注解式开发全解析
  • Java面试资源获取
  • vmware diffy配置ollama 本机ip无法访问