diff --git a/src/App.vue b/src/App.vue index c019d1e0..b42bf5ef 100644 --- a/src/App.vue +++ b/src/App.vue @@ -14,6 +14,7 @@ import ArticleContentDialog from "@/components/dialog/ArticleContentDialog.vue"; import CollectNotice from "@/components/CollectNotice.vue"; import {SAVE_SETTING_KEY, SAVE_DICT_KEY} from "@/utils/const.ts"; import {shakeCommonDict} from "@/utils"; +import router from "@/router.ts"; const store = useBaseStore() const runtimeStore = useRuntimeStore() @@ -69,6 +70,12 @@ async function init() { onMounted(() => { init() + + if (/Mobi|Android|iPhone/i.test(navigator.userAgent)) { + // 当前设备是移动设备 + console.log('当前设备是移动设备') + router.replace('/mobile') + } }) diff --git a/src/pages/mobile/index.vue b/src/pages/mobile/index.vue new file mode 100644 index 00000000..f0396c46 --- /dev/null +++ b/src/pages/mobile/index.vue @@ -0,0 +1,96 @@ + + + + + \ No newline at end of file diff --git a/src/router.ts b/src/router.ts index 897b76f5..4d98a37b 100644 --- a/src/router.ts +++ b/src/router.ts @@ -1,11 +1,13 @@ import * as VueRouter from 'vue-router' import Practice from "@/pages/practice/index.vue"; -import Dict from '@/pages/dict' +import Dict from '@/pages/dict/index.vue' +import Mobile from '@/pages/mobile/index.vue' import Test from "@/pages/test.vue"; const routes: any[] = [ {path: '/practice', component: Practice}, {path: '/dict', name: 'dict', component: Dict}, + {path: '/mobile', name: 'dict', component: Mobile}, {path: '/test', name: 'test', component: Test}, {path: '/', redirect: '/practice'}, ]