Browse Source

fix:更改无限跳转

jianghaili 6 days ago
parent
commit
5026dd7b59
1 changed files with 10 additions and 4 deletions
  1. 10 4
      src/App.vue

+ 10 - 4
src/App.vue

@@ -8,12 +8,18 @@ import { handleThemeStyle } from "@/utils/theme";
 import { onMounted, nextTick } from "vue";
 import { onMounted, nextTick } from "vue";
 import { isMobile } from "@/utils/utils";
 import { isMobile } from "@/utils/utils";
 onMounted(() => {
 onMounted(() => {
+   const currentHost = window.location.hostname;
+
   if (isMobile()) {
   if (isMobile()) {
-    console.log("当前设备是移动设备");
-    // window.location.href = "https://wap.wi-tour.com";
+    // 如果当前不是在 wap 域名,就跳转
+    // if (currentHost !== "wap.wi-tour.com") {
+    //   window.location.href = "https://wap.wi-tour.com";
+    // }
   } else {
   } else {
-    console.log("当前设备是电脑");
-    window.location.href = "https://www.wi-tour.com";
+    // 如果当前不是在 www 域名,就跳转
+    if (currentHost !== "www.wi-tour.com") {
+      window.location.href = "https://www.wi-tour.com";
+    }
   }
   }
   nextTick(() => {
   nextTick(() => {
     // 初始化主题样式
     // 初始化主题样式