如何在vue-router的beforeEach鉤子裏作頁面訪問權限驗證

通常前端作的話放到sessionStorage裏面,經過vuex去管理,直接上代碼吧(我項目裏'/'是登陸頁,'/Table'是登陸後的首頁)前端 // main.js router.beforeEach((to, from, next) => { if (to.path === '/' && sessionStorage.getItem('accessToken') && from.path
相關文章
相關標籤/搜索