链接标签中的HTML

时间:2019-02-28 11:56:19

标签: tabulator

我试图将标签设为HMTL(真棒字体图标),但它仅将其显示为文本。参见下面的示例:

columns:[       
    {
        title:"Order", width:100, field:"url_name", align:"center", headerSort:false, formatter:"link", formatterParams:{
            urlField:"url",
            label: "<i class="fas fa-link"></i>",
            target:"_blank",
        }       
    }   
]

1 个答案:

答案 0 :(得分:1)

使用自定义格式化程序: http://tabulator.info/docs/4.2/format#format-custom

columns:[       
    {
        title:"Order", width:100, field:"url_name", align:"center", headerSort:false
, formatter: (c, p) => {
    return `<a href='${p.urlField}' target='_blank'><i class='fas fa-link'></i></a>`
}, formatterParams:{
            urlField:"url",
        }       
    }   
]