Skip to content

class="className {{ className }}" cause duplicated result #2075

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
misaka42 opened this issue Dec 23, 2015 · 7 comments
Closed

class="className {{ className }}" cause duplicated result #2075

misaka42 opened this issue Dec 23, 2015 · 7 comments

Comments

@misaka42
Copy link

source:

<div class="icon icon-{{test}}"></div>

expect:

<div class="icon icon-test"></div>

result:

<div class="icon icon- icon-test"></div>

here's the code:

https://jsfiddle.net/10ons60y/

是我的使用姿势不对吗 (:3」∠)

@ludo237
Copy link

ludo237 commented Dec 23, 2015

That's an interesting behaviour, looking forward to some fix

@smolinari
Copy link

Interesting it hasn't been found sooner. Good catch.

Scott

@billcolumbia
Copy link

<div :class="['icon', 'icon-' + test]"></div> - Class Bindings - Array Syntax

@smolinari
Copy link

Nice Bill. Thanks for the solution.

Still, the binding of "test" shouldn't cause "icon-" to be inserted twice, should it?

Scott

@billcolumbia
Copy link

@smolinari I would say no. Judging by docs, I just went along with the two default ways to bind classes. Always assumed that interpolation in any attribute value wouldn't work without prefixing with v- or :.

@smolinari
Copy link

Cool. @pespantelis looks to have figured out the issue. Nice work Pantelis. 👍

Scott

@pespantelis
Copy link

Thanks @smolinari 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants