Comments (7)
Hi @ProfFan
Issue fixed in nprogress #6 .
Need code review by @fundon
But you still need to check current path before redirecting to avoid vue-router issue.
beforeEnter: (to, from, next) => {
if (from.path === '/components') {
next()
} else {
next('/components')
}
}
from nprogress.
Great, thanks :)
from nprogress.
P.S. @luventa Test case:
beforeEnter: (to, from, next) => {
if (from.path === '/components') {
next(false)
} else {
next('/components')
}
}
And the bar does not stop if I navigate to the guarded page when I was in '/components'.
from nprogress.
@ProfFan Yes, in that case router stops to call afterEach function. so the progress bar wont stop.
If you really need to abort the current navigation, we will need to provide the functionality for stopping progress bar manually.
from nprogress.
Maybe we should make a abort()
function?
from nprogress.
What about using decorators?
Write a decorator function to wrap the push/replace method which is in the VueRouter class, and then inject the nprogress start/end logic around the target.
from nprogress.
@xuzhy Yes, that will be an approach.
And actually, in previous version, vue-bulma/nprogress exported a function called 'done' to stop itself.
from nprogress.
Related Issues (18)
- 无法使用 HOT 3
- Keep getting cannot find className of null HOT 4
- Set parent does not work! HOT 2
- IE Error Object doesn't support property or method 'assign'
- axios may not be defined as Vue.axios (e.g. when using with Laravel) HOT 1
- Passing config when using .vue HOT 3
- Failed to find '~nprogress/nprogress.css' after use postcss-import HOT 12
- Error in beforeCreate hook: "SyntaxError: missing ) after argument list" HOT 2
- Trouble configuring this and getting it working HOT 1
- Not working at all HOT 7
- Safari fatal error HOT 9
- Custom calls support
- Can i css for this bar
- [vite] Internal server error: Failed to resolve import "vue-nprogress/src/NprogressContainer" from "src/App.vue". Does the file exist?
- ReferenceError: route is not defined HOT 2
- 这个控件不能在android下运行吗? HOT 2
- axios support HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nprogress.