zoukankan      html  css  js  c++  java
  • 导航守卫

    to  准备跳转到哪个页面

    from 从哪个页面中离开

    next  函数

    全局守卫

    router.beforeEach((to,from,next) => {
       if(to.path == '/login' || to.path == '/register'){
        next(); }else{
        alert('先登录')
        next('/login') } })

    组件守卫

    data () {
      return{
        name: 'zuo'
      }
    }
    beforeRouteEnter:(to, from, next) => {
      next(vm => {
        alert("123" + name)
      })
    }
    beforeRouteEnter:(to, from, next) => {
      if(confirm("确认离开吗")){
        next();
      }else{
        next(false)
      }
    }
  • 相关阅读:
    十二月31日
    十二月31号
    10,28
    10,27
    十月26
    十月22
    十月21
    十月二十
    十月16
    0227 数据库的知识
  • 原文地址:https://www.cnblogs.com/dreamMargin/p/10536562.html
Copyright © 2011-2022 走看看