Skip to content
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

Nativescript-vue v-template support #2390

Open
farfromrefug opened this issue Oct 17, 2020 · 6 comments
Open

Nativescript-vue v-template support #2390

farfromrefug opened this issue Oct 17, 2020 · 6 comments

Comments

@farfromrefug
Copy link

farfromrefug commented Oct 17, 2020

When using Vue in Nativescript we have a custom v component called v-template https://nativescript-vue.org/en/docs/utilities/v-template/
It kind of work like v-for. Kind of! the parent of the template defines a :items or a for property which is an array like object.
Then inside the template you can use item which is an object of items
Do you think you could add support for it so that we get completion on template?

Here is an example https://github.com/nativescript-vue/nativescript-vue/blob/5b6a382c39a8ce3d1782926c635abf49ebe700eb/samples/app/components/ListViewTest.vue#L8

Thanks

@yoyo930021
Copy link
Member

yoyo930021 commented Oct 17, 2020

Vetur support custom component data for custom framework or libs.

You need to add this:

  1. Add component data files. Example: https://github.com/vuejs/vue-router/tree/dev/vetur
  2. Add key in package.json. Example: https://github.com/vuejs/vue-router/blob/dev/package.json#L24

Doc: https://vuejs.github.io/vetur/component-data.html#other-frameworks

@yoyo930021
Copy link
Member

The tricky thing here is the if prop question.
If you want to get it right type check in template interpolation, We need to requiring special handling of if prop.

@farfromrefug
Copy link
Author

@yoyo930021 thanks ! tried that and got v-template to be "recognized. However what i would like is for vetur to "know" that item is an item of the array defined in :itemsabove the template, so that i get type and completion on theitemobject. Just like it happens withv-for`. Do you think this is possible?

@yoyo930021
Copy link
Member

yoyo930021 commented Oct 17, 2020

@yoyo930021 thanks ! tried that and got v-template to be "recognized. However what i would like is for vetur to "know" that item is an item of the array defined in :itemsabove the template, so that i get type and completion on theitemobject. Just like it happens withv-for`. Do you think this is possible?

This question is the same as if.
I think this is not easy to handle.
It is difficult for us to deal with this particular component.
Call @ktsn for check.

Why isn’t this API designed as a scoped slot?
This way you can avoid this problem perfectly.

@farfromrefug
Copy link
Author

@rigor789 do you a reason not to use slots as @yoyo930021 suggests?

@yoyo930021
Copy link
Member

yoyo930021 commented Oct 17, 2020

PS. scoped slot type check is not support now.
We will support in the future.
But this approach can also avoid many problems.

@octref octref mentioned this issue Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants