How to add dynamically attribute in VueJs

How to add dynamically attribute in VueJs

base one condition we can define or change attributes in vue

Please refer official document for the same https://vuejs.org/v2/guide/syntax.html#Attributes

 

you can add an attribute like v-for="(item, index) in numbers" :mycustom="item" , if there's an array [1,2,3,4]

Attributes

Mustaches cannot be used inside HTML attributes. Instead, use a v-bind directive:

<div v-bind:id="dynamicId"></div>

In the case of boolean attributes, where their mere existence implies true, v-bind works a little differently. In this example:

<button v-bind:disabled="isButtonDisabled">Button</button>

If isButtonDisabled has the value of null, undefined, or false, the disabled attribute will not even be included in the rendered <button> element.

上一篇:WPF TextBlock&Label随父级控件缩放


下一篇:How Many Tables————杭电OJ