[Vuejs]-Vue โ€“ Accessing the Vue instance beforeEnter to access function

0๐Ÿ‘

Iโ€™m not sure you can on a beforeEnter looking at the docs but you can achieve the same on a beforeRouteEnter inside the component itself. By passing a callback.

beforeRouteEnter (to, from, next) {
    getPost(to.params.id, (err, post) => {
      next(vm => vm.setData(err, post))
    })
  },

Leave a comment