评论 插件相关

This commit is contained in:
tangly1024.com
2024-11-21 12:56:30 +08:00
parent d5235b3e44
commit 5b5f7bc588
2 changed files with 55 additions and 62 deletions

View File

@@ -27,16 +27,9 @@ export const shuffleArray = array => {
* google机器人
* @returns
*/
export const isSearchEngineBot = () => {
if (typeof navigator === 'undefined') {
return false
}
// 获取用户代理字符串
const userAgent = navigator.userAgent
// 使用正则表达式检测是否包含搜索引擎爬虫关键字
return /Googlebot|bingbot|Baidu/.test(userAgent)
}
export const isSearchEngineBot =
typeof navigator !== 'undefined' &&
/Googlebot|bingbot|Baidu/.test(navigator.userAgent)
/**
* 组件持久化
*/