打赏

vue vue-router beforeRouteEnter

beforeRouteEnter (to, from, next) {
    // 在渲染该组件的对应路由被 confirm 前调用
    // 不!能!获取组件实例 `this`
    // 因为当守卫执行前,组件实例还没被创建
  },
beforeRouteEnter 里面的变量不能使用this,即不能使用data函数中定义的变量,可以使用外面定义的变量(非组件内定义的变量)。
posted @ 2018-06-21 09:30  孟繁贵  阅读(3494)  评论(0编辑  收藏  举报
TOP