vuejs / vetur

Vue tooling for VS Code.
https://vuejs.github.io/vetur/
MIT License
5.75k stars 593 forks source link

Add support for functional components #1313

Open renestalder opened 5 years ago

renestalder commented 5 years ago

Info

Problem

If functional components are defined in Single File Components, one has to access the Vue instance differently than in the case of a non functional component.

For example, $slots is going to be slots().

Vetur currently doesn't recognize if one is using functional components on a template.

Screenshot 2019-05-27 at 15 39 30

Reproducible Case

  1. Define a .vue component and add the functional tag to the property.
  2. Add property acces e.g. props.<propertyName> or slots e.g. slots().default. The build will work and the app will work in run time. But Vetur shows an error.

Additional information:

Similar issues

ktsn commented 5 years ago

FYI: <template functional> will be dropped in Vue v3. https://github.com/vuejs/rfcs/pull/27

renestalder commented 5 years ago

Interesting. Thanks for the link.

It's on "Request for comment" so we cannot yet be sure it will be dropped but it's a fair point to say that one should rather prepare for v3.

ktsn commented 5 years ago

Yeah, in any cases I'll investigate how we can support it in Vetur.

renestalder commented 4 years ago

@ktsn I feel like that's a shot into the dark. It now seems pretty clear that functional templates are dropped. Only functional components created via scripts will be available, with the reason that there will be no real performance difference between non functional and functional.

So, from my point view, that's not something that should be tackled at all and can be closed.

douglasg14b commented 2 years ago

This is very much needed IMHO, right now it just throws an error that:

Property 'props' does not exist

Which is problematic, and in the way.

At least a workaround would be workable.