beforeRouteEnter访问Vuex

beforeRouteEnter不能直接this.$store,可采用下面的方式

beforeRouteEnter(to, from, next) {
  const store = from.matched[0].instances.default.$store
  next()
}

[转自]:https://github.com/vuejs/vue-router/issues/1103

原文地址:https://www.cnblogs.com/zenple/p/14278930.html