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

Add support for functional components #1313

Open
3 tasks done
renestalder opened this issue May 27, 2019 · 5 comments
Open
3 tasks done

Add support for functional components #1313

renestalder opened this issue May 27, 2019 · 5 comments

Comments

@renestalder
Copy link

  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: macOS
  • Vetur version: 0.21.0
  • VS Code version: `.34.0

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
Copy link
Member

ktsn commented May 28, 2019

FYI: <template functional> will be dropped in Vue v3.
vuejs/rfcs#27

@renestalder
Copy link
Author

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
Copy link
Member

ktsn commented May 28, 2019

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

@renestalder
Copy link
Author

@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
Copy link

douglasg14b commented Dec 12, 2021

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.

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

4 participants