判断访问设备重定向

GST002_H5
JayChou 3 weeks ago
parent c2c25f2520
commit 72a8508bf2
  1. 8
      src/main.ts
  2. 4
      src/styles/index.scss

@ -51,14 +51,12 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
const useThemeStore = themeStore()
useThemeStore.initTheme()
const ua = navigator.userAgent.toLowerCase()
// console.log(ua,'ua');
const isMobile = /iphone|android|ipad|mobile/.test(ua)
if (isMobile) {
console.log('手机端')
// location.href = import.meta.env.VITE_APP_MOBILE_URL
} else if (!isMobile) {
console.log('电脑端')
// location.href = import.meta.env.VITE_APP_PC_URL
}

@ -9,8 +9,8 @@
--el-color-primary: #0BD7C6;
}
.container-1420{
width: 375px;
margin: 0 auto;
// width: 375px;
// margin: 0 auto;
// background-color: #c2acac;
}
.container-100{

Loading…
Cancel
Save