0👍
beforeRouteEnter
doesn’t have access to this
. You would have to use a function that is defined outside of the object scope and call the function before next. The argument passed to next is the your vue component object so that you can set the properties of the component.
Something like this will work:
beforeRouteEnter (to, from, next) {
axios.get('/service').then(res => {
next(vm => {
vm.res = res
})
}).catch(err => {
next(vm => {
vm.err = err
})
})
}
- [Vuejs]-Electron vue new window with child route
- [Vuejs]-Custom numberfield does not validate against NaN
Source:stackexchange.com