Hey, thanks for this library!
I've just started with both Dart and Vue and thus I've now been using your VueDart for a few days. I'd like to add some progress indicator when switching routes. Unfortunately, an instance of VueRouter does not expose a method to set either beforeHooks or afterHooks. I've managed to hack in the following:
final router = VueRouter(mode: VueRouterMode.history, routes: [
...
]);
// hacking in the router object
var hookable = (router.appOptions.entries.first.value as dynamic);
if (hookable != null) {
setProperty(hookable, 'beforeHooks', [
(dynamic to, dynamic from, Function next) {
if (to.name != null) {
NProgress.start();
}
next();
}
]);
setProperty(hookable, 'afterHooks', [
(dynamic to, dynamic from) => NProgress.done()
]);
}
This doesn't directly work when compiling with dart2js, as these functions do not translate well to javascript..
I am wondering if there is any support planned to add router before/after hooks?
Hey, thanks for this library!
I've just started with both Dart and Vue and thus I've now been using your VueDart for a few days. I'd like to add some progress indicator when switching routes. Unfortunately, an instance of VueRouter does not expose a method to set either
beforeHooksorafterHooks. I've managed to hack in the following:This doesn't directly work when compiling with
dart2js, as these functions do not translate well to javascript..I am wondering if there is any support planned to add router before/after hooks?