-
-
Notifications
You must be signed in to change notification settings - Fork 9
$navigator.path not updated correctly if using class style Vue components #31
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
Comments
I have no idea what's causing that with class components. Can you create a watcher and watch |
I tried the watcher but nothing get triggered. I added some console logs and i found that if I do:
And navigate to a "normal" component the console shows:
But with a class style component just:
It seems class style component doesn't receive properly the $options.__path |
Can you share the compiled source of a class component? (it should be in platforms folder somewhere in a |
Sure! The compiled source for:
Should be:
|
Yeah, that's way different from regular js components... If you edit the source of the navigator, specifically this line: nativescript-vue-navigator/index.js Line 13 in b19adc2
If you add if(routes[path].component.options) {
routes[path].component.options.__path = path
} Does that make a difference? |
¡Yes!, with that change the Watch works and $navigator.path is correctly updated :) Thank you veru much! 🕺 |
Great! Mind opening a PR with the change? Perhaps add a comment above the if block explaining why this is needed, something like // this is required to attach the path to vue-class-components. see #31
if(routes[path].component.options) {
routes[path].component.options.__path = path
} |
Sure! Thank you very much!
El jue., 26 mar. 2020 22:10, Igor Randjelovic <[email protected]>
escribió:
… Great! Mind opening a PR with the change?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#31 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMBU4PWMRCCALRNQLXENWDRJPAEXANCNFSM4LULJPKA>
.
|
…style Vue components
🎉 This issue has been resolved in version 1.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I have a sample where I'm using your plugin to navigate to two different components and show the path in the $navigator.path and it works perfectly:
app.js
routes/index.js
compontents/App.vue
components/c1.vue
components/c2.vue
If I use class Style Vue components with in the components:
components/c2.vue
Then $navigator.path isn't correctly updated and keeps the initial value.
The text was updated successfully, but these errors were encountered: