Browse Source

路由修改

sunzehao 3 months ago
parent
commit
318868993e
1 changed files with 72 additions and 69 deletions
  1. 72 69
      src/router/index.js

+ 72 - 69
src/router/index.js

@@ -1,77 +1,80 @@
-import { createRouter, createWebHistory } from 'vue-router'
+// import { createRouter, createWebHistory } from 'vue-router'
+import { createRouter, createWebHashHistory } from 'vue-router'
 import HomeView from '../views/HomeView.vue'
 
-const router = createRouter({
-  history: createWebHistory(import.meta.env.BASE_URL),
-  routes: [
-    // {
-    //   path: '/',
-    //   name: 'home',
-    //   component: HomeView
-    // },
-    {
-      path: '/',
-      name: 'CesiumMap',
-      component: () => import('../views/cesium.vue')
+const routes = [
+// {
+//   path: '/',
+//   name: 'home',
+//   component: HomeView
+// },
+{
+    path: '/',
+    name: 'CesiumMap',
+    component: () => import('../views/cesium.vue')
+},
+{
+    path: '/mapview',
+    name: 'mapview',
+    component: () => import('../views/mapview.vue')
+},
+{
+    path: '/satellitecloudchart',
+    name: 'satellitecloudchart',
+    component: () => import('../views/satellitecloudchart.vue')
+    },
+    //云图
+{
+    path: '/cloudLayer',
+    name: 'cloudLayer',
+    component: () => import('../views/cesiumComponents/cloudLayer.vue')
+    },
+    //降雨图
+{
+    path: '/rainLayer',
+    name: 'rainLayer',
+    component: () => import('../views/cesiumComponents/rainLayer.vue')
+    },
+//风速图
+{
+    path: '/temperatureLayer',
+    name: 'temperatureLayer',
+    component: () => import('../views/cesiumComponents/temperatureLayer.vue')
     },
-    {
-      path: '/mapview',
-      name: 'mapview',
-      component: () => import('../views/mapview.vue')
+{
+    path: '/mapdetail',
+    name: 'mapdetail',
+    component: () => import('../views/cesiumComponents/mapdetail.vue')
     },
-    {
-      path: '/satellitecloudchart',
-      name: 'satellitecloudchart',
-      component: () => import('../views/satellitecloudchart.vue')
-      },
-      //云图
-    {
-      path: '/cloudLayer',
-      name: 'cloudLayer',
-      component: () => import('../views/cesiumComponents/cloudLayer.vue')
-      },
-      //降雨图
-    {
-      path: '/rainLayer',
-      name: 'rainLayer',
-      component: () => import('../views/cesiumComponents/rainLayer.vue')
-      },
-    //风速图
-    {
-      path: '/temperatureLayer',
-      name: 'temperatureLayer',
-      component: () => import('../views/cesiumComponents/temperatureLayer.vue')
-      },
-    {
-      path: '/mapdetail',
-      name: 'mapdetail',
-      component: () => import('../views/cesiumComponents/mapdetail.vue')
-      },
-    //区域展示
-    {
-      path: '/geopolygon',
-      name: 'geopolygon',
-      component: () => import('../views/cesiumComponents/geopolygon.vue')
-      },
-      //地形展示
-    {
-      path: '/topographicMap',
-      name: 'topographicMap',
-      component: () => import('../views/cesiumComponents/topographicMap.vue')
-      },
-    {
-      path: '/about',
-      name: 'about',
-      // route level code-splitting
-      // this generates a separate chunk (About.[hash].js) for this route
-      // which is lazy-loaded when the route is visited.
-      component: () => import('../views/AboutView.vue')
+//区域展示
+{
+    path: '/geopolygon',
+    name: 'geopolygon',
+    component: () => import('../views/cesiumComponents/geopolygon.vue')
     },
-    {
-      path: "/:catchAll(.*)",
-      redirect: "/"
-    }
-  ]
+    //地形展示
+{
+    path: '/topographicMap',
+    name: 'topographicMap',
+    component: () => import('../views/cesiumComponents/topographicMap.vue')
+    },
+{
+    path: '/about',
+    name: 'about',
+    // route level code-splitting
+    // this generates a separate chunk (About.[hash].js) for this route
+    // which is lazy-loaded when the route is visited.
+    component: () => import('../views/AboutView.vue')
+},
+{
+    path: "/:catchAll(.*)",
+    redirect: "/"
+}
+]
+
+const router = createRouter({
+  history: createWebHashHistory(), // 使用 hash 模式
+  routes
 })
 
 export default router