瀏覽代碼

新增路由模式

xinfeng 5 年之前
父節點
當前提交
f4422cd85a
共有 1 個文件被更改,包括 8 次插入4 次删除
  1. 8 4
      plugins/router.js

+ 8 - 4
plugins/router.js

@@ -5,21 +5,25 @@ export default ({ app, store }) => {
     const isJishuin = host.indexOf('jishuin') !== -1
     const isJob = host.indexOf('job') !== -1
 
+    console.log("app.router.options.routes", app.router.options.routes)
     if (isKaifain) {
+      let kaifainIndex = app.router.options.routes.filter(v => v.name === 'kaifainSeoIndex')[0]
+      let kaifainDetail = app.router.options.routes.filter(v => v.name === 'kaifainSeoDetail')[0]
+      let kaifainCaseDetail = app.router.options.routes.filter(v => v.name === 'kaifainCaseSeoDetail')[0]
       app.router.options.routes.unshift({
         name: 'kaifain_$',
-        path: '/',
-        component: () => import('@/pages/kaifain/index.vue')
+        path: '/*',
+        component: kaifainIndex.component
       })
       app.router.options.routes.unshift({
         name: 'kaifainSeoDetails_$',
         path: '/s/:tid',
-        component: () => import('@/pages/kaifain/detail/_tid/index.vue')
+        component: kaifainDetail.component
       })
       app.router.options.routes.unshift({
         name: 'kaifainCaseSeoDetails_$',
         path: '/d/:tid',
-        component: () => import('@/pages/kaifain/case/_tid.vue')
+        component: kaifainCaseDetail.component
       })
       app.router.matcher.addRoutes([{
         name: 'kaifainSeoDetails_$',