mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-09 15:10:39 +00:00
document 非空判断
This commit is contained in:
@@ -11,23 +11,23 @@ export const LayoutSearch = (props) => {
|
||||
const { keyword } = props
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
const container = document.getElementById('container')
|
||||
const container = typeof document !== 'undefined' && document.getElementById('container')
|
||||
if (container && container.innerHTML) {
|
||||
const re = new RegExp(`${keyword}`, 'gim')
|
||||
container.innerHTML = container.innerHTML.replace(re, `<span class='text-red-500 border-b border-dashed'>${keyword}</span>`)
|
||||
}
|
||||
},
|
||||
100)
|
||||
100)
|
||||
})
|
||||
return <LayoutBase {...props}>
|
||||
<div className='py-12'>
|
||||
<div className='pb-4 w-full'>{locale.NAV.SEARCH}</div>
|
||||
<SearchInput currentSearch={keyword} {...props}/>
|
||||
<TagGroups {...props}/>
|
||||
<CategoryGroup {...props}/>
|
||||
<SearchInput currentSearch={keyword} {...props} />
|
||||
<TagGroups {...props} />
|
||||
<CategoryGroup {...props} />
|
||||
</div>
|
||||
<div id='container'>
|
||||
<BlogPostListScroll {...props}/>
|
||||
<BlogPostListScroll {...props} />
|
||||
</div>
|
||||
</LayoutBase>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user