iview官网截图:使用介绍👇
自定义渲染列,使用 Vue 的 Render 函数。传入两个参数,第一个是 h,第二个为对象,包含 row、column 和 index,分别指当前行数据,当前列数据,当前行索引,详见示例。 学习 Render 函数的内容
使用方法:如图:
代码如下:因为我是要做在表格上展示多个上传后的附件
render(h,{row}){
if(row.securityFile.length){
console.log(row.securityFile,JSON.parse(row.securityFile))
let arrFile = JSON.parse(row.securityFile)
return arrFile.map((item)=>{
return h('p', {
attrs: {
class: 'tableFileStyle'
},
on: {
click: () => {
jumpDownfile(item)
}
}
}, `${item.name}`)
})
}else{
return '-'
}
备注:这是我在网上看到的一个博主写的,写的很详细,大家有需要可以借鉴此博主写的
地址链接:https://www.cnblogs.com/wssdx/p/10644641.html