mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 03:29:59 +08:00
parent
604584931e
commit
78af67a057
@ -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>
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user