本文主要是介绍Meilisearch客户端完美改造,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
关键部分:原来Body部分显示有问题,对\n视而不见。
改造:
// Used in Bannertypo15: {tag: 'span',style: css`font-size: 15px;font-weight: 300;line-height: 25px;display: inline-block;`,},// Used in BodytypoBody: {tag: 'span',style: css`font-size: 15px;font-weight: 300;line-height: 25px;white-space: pre-wrap;`,},...const Highlight = connectHighlight(({ highlight, attribute, hit, indexContextValue, ...props }) => {const parsedHit = highlight({highlightProperty: '_highlightResult',attribute,hit,})return (<Typography variant="typoBody" {...props}>{parsedHit.map((part, index) =>part.isHighlighted ? (<mark key={index}>{part.value}</mark>) : (<span key={index}>{part.value}</span>))}</Typography>)}
)
其它改造不说了,没什么惊喜。
这篇关于Meilisearch客户端完美改造的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!