Skip to content

[feature request] :class object support multiple class names as key #2571

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

Closed
luwenjin opened this issue Mar 26, 2016 · 4 comments
Closed

[feature request] :class object support multiple class names as key #2571

luwenjin opened this issue Mar 26, 2016 · 4 comments
Assignees

Comments

@luwenjin
Copy link

just like this
:class="{'a b c': flag, d: flag2}"
as well as this
:class="[flag?'a b c':'']"

@luwenjin luwenjin changed the title [feature request] :class object support multiple class name as key [feature request] :class object support multiple class names as key Mar 26, 2016
@luwenjin
Copy link
Author

this is a real life example when i was using semantic-ui framework,
they often have multiple class names tide to one condition.
My instinct tell me to type like the first example, however Vue gave me an error.

@luwenjin
Copy link
Author

So I tried as the second example. and I failed again

@Axnyff
Copy link

Axnyff commented Mar 26, 2016

The second exemple would work as an expression returning a string, not a list.
The best way to it imo would be to use a list as a property computed from flag

https://jsfiddle.net/x54ju3em/1/

@luwenjin
Copy link
Author

@Axnyff use a string works well.
the first case is still worth consideration (I've edit a little to reflect the use case)

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