-
-
Notifications
You must be signed in to change notification settings - Fork 9
Cannot reuse components as views, using meta #22
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
Share your code - can't help if I don't know how you are using it. |
The code below works perfectly fine if I copy it to two components, News.vue and Seminare.vue. Both have the same layout, etc. Just different content. When I try to use 'meta' in the navigator to load different content in a single component (Posts), I get the same content in both (the last one referenced in the navigator config). And as I said, leaving everything as it is, as long as it's two separate components it works. You just can't re-use a component in the navigator. Not sure if this is a limitation of navigator or of NativeScript Vue... routes.js:
Posts.vue computed:
template: Here |
Just checked this, and correct - components can't be reused for multiple routes. I don't see an easy way to fix this, as the components have to keep track what route they belong to: nativescript-vue-navigator/index.js Line 7 in 99f9e36
nativescript-vue-navigator/index.js Lines 10 to 17 in 99f9e36
However, it's possible to work around the issue with cloning the component. For example component: Object.assign({}, Posts) |
'/news': { component: Posts, meta: { path: 'news', title: 'News', } },
I'm trying to use one component, Posts.vue, for multiple views. But all the views turn in to the last referenced in the navigator setup. The content in Posts is loaded using the meta.path.
Seems I have to make duplicates of this Posts component for it to work. Weird.
The text was updated successfully, but these errors were encountered: