vue實現表格中添加標籤,標籤是多個需要循環-render函數 for循環返回

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"}}, "添加標籤")
      ]);

效果:

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章