坚果大叔 坚果大叔
  • 首页
  • 闲言碎语
  • 技术
  • 生活
  • 记录
  • 朋友
  • 热点新闻
  • 常用代码
  • 工具箱
  • 关于
首页 › 技术 › Element render函数中使用map插入多条数据!

Element render函数中使用map插入多条数据!

坚果大叔
2021-10-21 15:06:13技术阅读 2,604

在iview中经常频繁的使用render函数来进行表格的内容动态显示。其插入的方法如下:

{
  title: "参加人员名单",
  align: "left",
  minWidth: 180,
  render: (h, { row }) => {
    return h("div", [
      // 直接map输出即可
      data.map(item => {
        h("p", item.name);
      })
    ]);
  }
}

在Element中render函数的插入方法如下:

const h = this.$createElement;
let messageData = [];

messageData.push(h("span", null, "遍历列表之前的数据"));

// 通过 map 生成的数据
data.map(item => {
    messageData.push(h("span", item.name)
});

messageData.push(h("span", null, "遍历列表之后的数据"));

message: h("div", null, messageData)
问题记录
赞赏 赞(0)
本文系作者 @坚果大叔 原创发布在 坚果大叔。未经许可,禁止转载。
JS批量下载网页中的图片!
上一篇
十月末
下一篇
在小程序中查看

评论已关闭

搜你想看的
聚合文章
网站统计工具Umami的傻瓜安装指南~
老家的桃树和梨树
响应式网站移动端hover处理
Python + Wxpy 搭建简单微信机器人
闲言碎语
Memos
npm install 出现 Error:EISDIR:illegal operation on a directory 的错误提示!
2025-03-31 19:02:11
551 0 0
iphone 利用 Scriptable 添加网上国网电费小组件
2025-01-06 20:40:20
4,938 6 2
在博客中加上memos记录展示。
2024-12-25 23:41:27
2,293 5 2
网页点击平滑滚动效果~
2024-10-17 16:43:08
2,011 4
  • 0
博主

一位佛系的前端开发者,略通摄影,乐于尝试新事物,热衷于美食。

友链
故事胶片
公众号
坚果大叔 执行上下文 卖坚果的怪叔叔 Dacking
Copyright © 2017-2025 坚果大叔

开往-友链接力

萌ICP备20230818号

苏ICP备18048410号-3
  • 首页
  • 闲言碎语
  • 技术
  • 生活
  • 记录
  • 朋友
  • 热点新闻
  • 常用代码
  • 工具箱
  • 关于
# CSS # # JavaScript # # vue # # 微信 # # 生活 #
坚果大叔
317
文章
125
评论
365
喜欢