登錄攔截(轉(zhuǎn))
原文地址:https://www.cnblogs.com/zjwxy/p/9197627.html
一。路由攔截
項(xiàng)目中某些頁面需要用戶登錄后才可以訪問,在路由配置中添加一個(gè)字段requireAuth
- 在router/index.js中 。

注:這里判斷登錄是通過登錄成功后將后臺返回的token存在localstorage中來判斷的
二。axios請求攔截(最常用的方法)

原文地址:https://www.cnblogs.com/zjwxy/p/9197627.html
- 在router/index.js中 。