用的ivue組件Table所以不能在標籤上用v-for,下面代碼是一列政策文件,圖在最後,在網上找了好久render渲染多個a標籤都沒找到,render中還不能循環渲染,這是自己根據vue中v-for的原理寫的。
arr是要循環出來的數組
{
title: '政策文件',
key: 'policyFile',
align: 'center',
render: (h, params) => {
var arr = params.row.policyFile.split(";")
return h('ul', arr.map(function (item,index) {
return h('a',{
domProps:{
href: item,
target: '_black'
},
style: {
marginRight: '5px'
}
}, '文件'+parseInt(index+1))
}))
}
},
效果圖