Vue: Merging of HTML classes via class attribute and v-bind broken

Created on 3 Aug 2016  路  9Comments  路  Source: vuejs/vue

Vue.js version

1.0.26

Reproduction Link

http://jsfiddle.net/d3xwtrqn/

Steps to reproduce

As shown in the jsfiddle: The combination of a class attribute and the dynamic :class leads to a merged class attribute. However using v-bind does not.

What is Expected?

Both ways should merge correctly.

bug

Most helpful comment

Oopps.

This is the second time witin a few hours that I found out something new about a Vue feature of which I thought I knew everything... and this is even clearly documented in the API docs ... My bad.

All 9 comments

If you do :v-bind instead of v-bind it works. Also v-bind:class="classes" works (since v-bind:class becomes :class)

v-bind="..." will not work, it'is not supported as i know. Shorthand for this is :="..." :-). It should be v-bind:<attribute>="..." this is not a bug

:v-bind is element attribute 'v-bind' binding to value, like binding 'data-something'. I have thought that it is possible =D

As explained by @iagafonov this is not a bug, but a template syntax error on OP's part.

I'm therefore closing this.

v-bind does support binding an object, so the original fiddle is using it as intended.

Oopps.

This is the second time witin a few hours that I found out something new about a Vue feature of which I thought I knew everything... and this is even clearly documented in the API docs ... My bad.

This appears to be fixed as of v2.4.4: http://jsfiddle.net/d3xwtrqn/5/

This issue is about the 1.x branch, not 2.x

Closing 1.x issues as 1.x is now end of life and will only receive critical security patches.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paceband picture paceband  路  3Comments

paulpflug picture paulpflug  路  3Comments

wufeng87 picture wufeng87  路  3Comments

julianxhokaxhiu picture julianxhokaxhiu  路  3Comments

6pm picture 6pm  路  3Comments