Update home.tsx

This commit is contained in:
dockersky 2023-04-02 17:24:44 +08:00 committed by GitHub
parent b4d30a6551
commit 5bf6496b21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 11 deletions

View File

@ -623,9 +623,31 @@ export function Home() {
.catch((error) => console.error(error));
}, []);
const isWorkWechat = () => {
//const isWorkWechat = () => {
//获取user-agaent标识头
const ua = window.navigator.userAgent.toLowerCase();
// const ua = window.navigator.userAgent.toLowerCase();
//判断ua和微信浏览器的标识头是否匹配
// if (
// ua.match(/micromessenger/i) == "micromessenger" &&
// ua.match(/wxwork/i) == "wxwork"
//) {
// return true;
//} else {
// return false;
//}
//};
const isWorkWechat = () => {
// 获取user-agent标识头
const userAgent = window.navigator.userAgent;
// 检查userAgent是否为null或undefined
if (!userAgent) {
return false;
}
// 转换为小写
const ua = userAgent.toLowerCase();
// 判断ua和微信浏览器的标识头是否匹配
if (
ua.match(/micromessenger/i) == "micromessenger" &&