Vue study notes: v-bind attribute dynamic binding

v-bind Role of

v-bind properties and dynamic instructions may be bound expression node

v-bind properties can be bound to various elements html

E.g:

<a v-bind:href="xxx"></a>

xxx can be data in the variable, it may also be a function, etc.

Syntactic sugar

v-bindIt can be abbreviated as :
i.e. v-bind:xxxabbreviated:xxx

class dynamic binding properties

Common spellings: class stood array can be bound to a class name, can also bind an object or objects can also be placed in an array of
objects, the key represents the class name, value indicates whether this class is enabled

  • :class="['a', 'b', 'c']"
  • :class="['a', 'b', {k1:v1, k2:v2}]"
  • :class="{k1:v1, k2:v2}"
  • :class="obj"

~~~~~ END ~~~~~

Guess you like

Origin www.cnblogs.com/wbyixx/p/11963496.html