-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
router.push & router.replace to return promise if callbacks are not provided #1769
Comments
This seems to work fine if for example your component is expecting an event.
|
Any progress on this? Seems a bit backwards in 2019 that we still have to use a callback API, and can't simply |
Here's a simple helper function in the mean time... /**
* Async push method
*/
router.pushAsync = function(route) {
return new Promise((resolve, reject) => {
router.push(route, resolve, reject);
});
}; |
I will try implement this issue. |
The problem is
https://github.com/vuejs/vue/blob/dev/src/core/util/next-tick.js should I implement this similar to |
Yes, it's similar to nextTick. It must work when Promises are not supported. The behavior only changes when no callback is passed and there is support for Promises |
What problem does this feature solve?
It would help preventing callback hell... Would be more consistent with vue js api...
What does the proposed API look like?
router.push('/new/url').then(() => doSomeCoolStuff())
The text was updated successfully, but these errors were encountered: