跳到主要内容

关键词高亮函数

    handleSearchText = (name: string, searchValue: string) => {
if(!name) return ''
        const index = name.indexOf(searchValue);
        const beforeStr = name.substring(0, index);
        const afterStr = name.slice(index + searchValue.length);
        const title = index > -1 ? (
            <span>
                {beforeStr}
                <Typography.Text mark>{searchValue}</Typography.Text>
                {afterStr}
            </span>
        ) : (
            name
        );
        return title
    }