美文网首页
vue 之 beforeRouteEnter , beforeR

vue 之 beforeRouteEnter , beforeR

作者: milletmi | 来源:发表于2018-05-04 15:27 被阅读0次

    beforeRouteEnter (to, from, next) {
    // 在渲染该组件的对应路由被 confirm 前调用
    // 不!能!获取组件实例 this
    // 因为当钩子执行前,组件实例还没被创建
    },
    beforeRouteUpdate (to, from, next) {
    // 在当前路由改变,但是该组件被复用时调用
    // 举例来说,对于一个带有动态参数的路径 /foo/:id,在 /foo/1 和 /foo/2 之间跳转的时候,
    // 由于会渲染同样的 Foo 组件,因此组件实例会被复用。而这个钩子就会在这个情况下被调用。
    // 可以访问组件实例 this
    },
    beforeRouteLeave (to, from, next) {
    // 导航离开该组件的对应路由时调用
    // 可以访问组件实例 this
    }

    相关文章

      网友评论

          本文标题:vue 之 beforeRouteEnter , beforeR

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