xinfeng 5 роки тому
батько
коміт
e66a2a795f
1 змінених файлів з 25 додано та 20 видалено
  1. 25 20
      plugins/router.js

+ 25 - 20
plugins/router.js

@@ -1,27 +1,32 @@
 export default ({app, store}) => {
+  
+  if (process.client) {
+    app.router.options.routes.unshift({
+      name: 'kaifainSeoDetails_$',
+      path: '/s/:tid',
+      component: () => import('@/pages/kaifain/detail/_tid/index.vue')
+    })
+    app.router.options.routes.unshift({
+      name: 'kaifainCaseSeoDetails_$',
+      path: '/d/:tid',
+      component: () => import('@/pages/kaifain/case/_tid.vue')
+    })
+    app.router.matcher.addRoutes([{
+      name: 'kaifainSeoDetails_$',
+      path: '/s/:tid',
+      component: () => import('@/pages/kaifain/detail/_tid/index.vue')
+    }, {
+      name: 'kaifainCaseSeoDetails_$',
+      path: '/d/:tid',
+      component: () => import('@/pages/kaifain/case/_tid.vue')
+    }])
+    console.log('router', app.router)
+  }
+  
   app.router.beforeEach((to, from, next)=> {
     if (process.client) {
       console.log("location.href", to, from)
-      app.router.options.routes.unshift({
-        name: 'kaifainSeoDetails_$',
-        path: '/s/:tid',
-        component: () => import('@/pages/kaifain/detail/_tid/index.vue')
-      })
-      app.router.options.routes.unshift({
-        name: 'kaifainCaseSeoDetails_$',
-        path: '/d/:tid',
-        component: () => import('@/pages/kaifain/case/_tid.vue')
-      })
-      app.router.matcher.addRoutes([{
-        name: 'kaifainSeoDetails_$',
-        path: '/s/:tid',
-        component: () => import('@/pages/kaifain/detail/_tid/index.vue')
-      }, {
-        name: 'kaifainCaseSeoDetails_$',
-        path: '/d/:tid',
-        component: () => import('@/pages/kaifain/case/_tid.vue')
-      }])
-      console.log(app.router)
+      
     }
     next()
   })