0
点赞
收藏
分享

微信扫一扫

vue实现表格中添加标签,标签是多个需要循环-render函数 for循环返回

君心浅语 2022-09-18 阅读 164

vue实现表格中添加标签,标签是多个需要循环--

实现:render函数 for循环返回多个div

fields_columns:[
{
type: 'index',
width: 60,
align: 'center'
},{
title: '字段',
sortable: true,
ellipsis:true,
width: 200,
key: 'column_name'
},{
title: '类型',
width: 200,
ellipsis:true,
key: 'column_type'
},{
title: '注释',
ellipsis:true,
width: 300,
key: 'commentString'
},{
title: "安全等级",
width: 100,
render: (h, params) => {
let tag = params.row.tag_safe;
if(tag){
return h("div", [
h("h-tag", {props: {color: "green"}},"安全"+tag+"级"),
]);
}
}
},{
title: "标签",
width: 300,
render: (h, params) => {
let tag = params.row.tag_content_list;
return h("div", [
tag.map(function (items,index){
return h("h-tag", {props: {color: "yellow"}},items.tag_content)
}),
h("Button", {props: {icon:"ios-plus-empty",type:"dashed",size:"small"}}, "添加标签")
]);

效果:

vue实现表格中添加标签,标签是多个需要循环-render函数 for循环返回_ios

 


作者:少帅




举报

相关推荐

0 条评论