|
@@ -11,11 +11,27 @@ export default {
|
|
|
reload: this.reload,
|
|
|
};
|
|
|
},
|
|
|
+
|
|
|
+ watch: {
|
|
|
+ // 监听 $route 对象的变化
|
|
|
+ '$route'(to, from) {
|
|
|
+ // 防止重复判断设备
|
|
|
+ if (this.deviceType =='PC'){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //排出手机扫码验证页面
|
|
|
+ if (to.path!="/prod/validate"){
|
|
|
+ this.detectDeviceType();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
isRouterAlive: true,
|
|
|
+ deviceType:null
|
|
|
};
|
|
|
},
|
|
|
+
|
|
|
created() {
|
|
|
// 在组件创建时检测设备类型
|
|
|
//this.detectDeviceType();
|
|
@@ -36,6 +52,8 @@ export default {
|
|
|
if (isMobile) {
|
|
|
// 跳转到移动端
|
|
|
window.location.replace(process.env.VUE_APP_MOBILE);
|
|
|
+ }else{
|
|
|
+ this.deviceType='PC';
|
|
|
}
|
|
|
},
|
|
|
},
|