Commit 7ebcda48 authored by 何毅恒's avatar 何毅恒

c

parent 369d2aa8
<script setup lang="ts"> <script setup lang="ts">
// import { onMounted, computed } from "vue";
// import { useRouter } from "vue-router"; // import { useRouter } from "vue-router";
// onMounted(() => { // onMounted(() => {
// detectDeviceType(machineType.value); // detectDeviceType(machineType.value);
......
...@@ -5,9 +5,11 @@ ...@@ -5,9 +5,11 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted } from "vue"; import { onMounted } from "vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
onMounted(() => { onMounted(() => {
detectDeviceType(); detectDeviceType();
}); });
const router = useRouter(); const router = useRouter();
const detectDeviceType = (): void => { const detectDeviceType = (): void => {
const machineType = const machineType =
...@@ -17,9 +19,9 @@ const detectDeviceType = (): void => { ...@@ -17,9 +19,9 @@ const detectDeviceType = (): void => {
? "Mobile" ? "Mobile"
: "Desktop"; : "Desktop";
if (machineType == "Mobile") { if (machineType == "Mobile") {
router.push("/mobile"); router.replace("/mobile");
} else { } else {
router.push("/pc"); router.replace("/pc");
} }
}; };
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment