[Vuejs]-Passing multiple properties in vuejs witch class

0👍

In your code example, when you add multiple bindings this way v-bind="[test, test_one]", it transforms into following bindings on the element:

class="test"
class="test--one"

Which, means that the last value overwrites class binding and you are left with a single value of test--one.

As a solution, classes can be passed the same way as multiple bindings – as an array or object. Here is an example:

Edit Vue global mixins

Note, that this is an example of more flexible usage of bindings. In order to make reusing components efficiently, initial data format of mixin’s data property may require adjustments.

Leave a comment