我的后端服务(elasticsearch percolator)使用 html 标签注释文本以突出显示匹配项。
我找不到在 antd Table 中显示此类 html 数据的方法。
我试过 Highlighter 组件,但它将关键字应用于整列,但我需要在每一行中突出显示不同的单词。
const { Table } = antd
class TableColor extends React.Component {
constructor (props) {
super(props)
this.state = {
data: []
}
}
componentDidMount() {
this.setState({
data: [
{id:1, name: 'Lazy < bclass="myBackgroundColor">fox</b>', match: 'fox'},
{id:2, name: '<b class="myBackgroundColor">Dog</b> runs', match: 'Dog'},
{id:3, name: 'I saw <b class="myBackgroundColor">duck</b>', match: 'duck'}
]
})
}
render () {
const columns = [{
title: 'ID',
dataIndex: 'id',
}, {
title: …Run Code Online (Sandbox Code Playgroud)