[Vuejs]-How do you dynamically add attributes(with value) to an element in VueJs

1👍

Try to return null when the condition is not satisfied, an attribute bound to null will not be rendered :

<div :class="{someCondition? 'my-class':null" >
</div>

if the condition is false the rendered element will be

<div >
</div>

Leave a comment