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