hilongjw / vue-progressbar

A lightweight progress bar for vue
http://hilongjw.github.io/vue-progressbar
MIT License
1.46k stars 162 forks source link

Anyway to use with beforeRouteEnter on a Component? #70

Closed ggedde closed 6 years ago

ggedde commented 6 years ago

beforeRouteEnter doesn't have access to 'this'

I was hoping for Vue.$Progress.start(), but that doesn't work. Anyway to access $Progress within beforeRouteEnter inside a component? Anyway to access $Progress from Vue?

Ex.

beforeRouteEnter (to, from, next) {
    Vue.$Progress.start()
    setTimeout(() => {
        Vue.$Progress.finish()
        next()
    }, 3000)
},
hilongjw commented 6 years ago
beforeRouteEnter (to, from, next) {
    Vue.prototype.$Progress.start()
    setTimeout(() => {
        Vue.prototype.$Progress.finish()
        next()
    }, 3000)
},
ggedde commented 6 years ago

Perfect, Thanks