美文网首页
router.beforeEach((to, from, nex

router.beforeEach((to, from, nex

作者: 飞鱼_JS | 来源:发表于2017-08-26 23:20 被阅读0次
    router.beforeEach((to, from, next) => {
      if (to.path != '/login') {
        if (!window.sessionStorage.getItem("username")) {
          next({
            path: '/login'
          })
        } else {
          next()
        }
      } else {
        next()
      }
    })
    

    相关文章

      网友评论

          本文标题:router.beforeEach((to, from, nex

          本文链接:https://www.haomeiwen.com/subject/zfovdxtx.html