Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
DOM class attribute not rendered properly with functional components #1014
Steps to reproduce
Create a functional component using the single file way (
What is expected?
It should merge the two classes on the root element and provide scope css support
I should get
What is actually happening?
The css classes are not merged. It only applies those from the functional component.
This is working if I write my component with only JS.
We may introduce proper class/style merging for template-based functional component in a patch release.
Hi, thanks for this precision. The weird thing is that if you inspect the "test2" which is a pure JS functional component, it actually works. So it's like it's a half-working feature ;)
If you look at my implementation of the two functional components, they look pretty similar. I don't know how vue-loader transform the template-based functional component into a pure JS functional component but it seems that it forgot to add context.data as the second parameter of the render function.
I was stuck on this issue too, rolling out custom solution to work with html template was actually pretty easy for my limited requirements
the problem is that you can't use
Of course you can do this with the render functions, and have more logic in there, but then you're not using the templates.
but easier yet is to not use functional components, which in my case (with few components) has little effect.