From b5302d96c97f69aa2e6a9cf5aa593f7465bd930c Mon Sep 17 00:00:00 2001 From: rose <1942951600@qq.com> Date: Thu, 13 May 2021 18:39:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 27 ++++++++++++++++++++++++++- src/main.js | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/App.vue b/src/App.vue index 1b603b3..60ab4de 100644 --- a/src/App.vue +++ b/src/App.vue @@ -33,6 +33,8 @@ export default { window.scroll(0, 0); }, created() { + this._isMobile(); + // const userId = '1218763410024566784'; // const params = { userId }; // this.getUserId(params); @@ -44,7 +46,30 @@ export default { // }); }, - methods: { ...mapActions('user', ['getUserId']) }, + methods: { + ...mapActions('user', ['getUserId']), + _isMobile(){ + let flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i) + // localStorage.setItem('isiphone',flag) + // localStorage.setItem('ismobile',flag?1:0) + // return flag; + console.log("======>",flag) + let ismobile = flag ? 1 : 0 + // 电脑 + // 手机 + if (ismobile == 1) { + console.log("ismobile2",flag) + // if (to.path == '/') { + // next('/home') + // } else { + // next(); + // } + window.location.href = "https://www.hao123.com/" + } + + }, + + }, }; diff --git a/src/main.js b/src/main.js index 86f4bbf..87833fe 100644 --- a/src/main.js +++ b/src/main.js @@ -30,4 +30,4 @@ window.vm = new Vue({ router, store, render: h => h(App), -}).$mount('#app'); +}).$mount('#app'); \ No newline at end of file