docs: fix table custom search panel demo

close #10494
This commit is contained in:
Wei Zhu 2018-05-15 11:58:02 +08:00
parent 604584931e
commit 78af67a057

View File

@ -33,7 +33,7 @@ const data = [{
address: 'Sidney No. 1 Lake Park',
}, {
key: '4',
name: 'Jim Red',
name: 'Jim Redjim',
age: 32,
address: 'London No. 2 Lake Park',
}];
@ -63,8 +63,9 @@ class App extends React.Component {
...record,
name: (
<span>
{record.name.split(reg).map((text, i) => (
i > 0 ? [<span className="highlight">{match[0]}</span>, text] : text
{record.name.split(new RegExp(`(?<=${searchText})|(?=${searchText})`, 'i')).map((text, i) => (
text.toLowerCase() === searchText.toLowerCase() ?
<span key={i} className="highlight">{text}</span> : text // eslint-disable-line
))}
</span>
),