guhongwei hace 4 años
padre
commit
5278609dd3
Se han modificado 1 ficheros con 9 adiciones y 0 borrados
  1. 9 0
      src/router/before.js

+ 9 - 0
src/router/before.js

@@ -0,0 +1,9 @@
+import store from '@/store/index';
+
+const checkLogin = (router, func) => {
+  router.beforeEach(async (to, form, next) => {
+    let res = await store.dispatch('login/toGetUser', func ? func : null);
+    next();
+  });
+};
+export default checkLogin;