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

Merge common class names of component and root element of that component #8015

Open
jimut opened this issue Apr 13, 2018 · 2 comments
Open

Comments

@jimut
Copy link

jimut commented Apr 13, 2018

What problem does this feature solve?

It looks a little awkward if there are duplicate class names in a DOM element.

What does the proposed API look like?

If you look into this fiddle.

The div element of foo component will have two bar classes in it. So it looks like.

<div class="bar bar"></div>

If the two classes would have been merged into one.

<div class="bar"></div>

It would have worked and behaved exactly in the same way but the code will look a lot cleaner.

@astronomersiva
Copy link

astronomersiva commented Apr 16, 2018

I am working on this.

Update: I have created a PR at #8035.

@sodatea sodatea added the has PR label Jun 7, 2018
@Mushr0000m
Copy link

I have the same issue. I need to keep the class in the component because it make sense for the component to know it's own class name for style etc..

But also need to keep the class attribute on the component call because it's a wrapper component around some server side generated content (header and footer), so without this class I have a glitch while Vuejs mount the component with the class name and so the browser doesn't apply the css.

I tried to look in beforeMount or mountedto remove duplicates but can't find a way. I know it works anyway, but the double class name looks weird, so if you know a solution to remove this, it would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment