浏览代码

增加路由监听

xinfeng 5 年之前
父节点
当前提交
f4116e86aa
共有 1 个文件被更改,包括 8 次插入7 次删除
  1. 8 7
      plugins/router.js

+ 8 - 7
plugins/router.js

@@ -1,11 +1,6 @@
-export default ({
-  app,
-  store
-}) => {
+export default ({ app, store }) => {
   if (process.client) {
-    const {
-      host
-    } = location || {}
+    const { host } = location || {}
     const isKaifain = host.indexOf('kaifain') !== -1
     const isJishuin = host.indexOf('jishuin') !== -1
     const isJob = host.indexOf('job') !== -1
@@ -119,5 +114,11 @@ export default ({
     }
 
     console.log('router', app.router)
+    
+    app.router.beforeEach((to, from, next)=> {
+      console.log("location.href", to, from)
+      next()
+    })
+    
   }
 }