router.beforeEach((to, from, next) => {
let isLogin = window.sessionStorage.getItem('loginUserNameKey');
if (isLogin) {
//如果用戶信息存在則往下執行。
next()
} else {
//如果用戶token不存在則跳轉到login頁面
if (to.path === '/login') {
next()
} else {
next('/login')
}
}
})