// 标识出搜索的文字 import React from 'react'; export const highlightText = (text: string, searchText: string) => { if (!text || !searchText) return text; const regex = new RegExp(`(${searchText})`, 'gi'); const parts = text.split(regex); return ( {parts.map((part, i) => part.toLowerCase() === searchText.toLowerCase() ? {part} : part )} ); };