SoFunction
Updated on 2025-04-05

Attribute method for dynamically binding form elements in vue

Sometimes in vue, you may want to add attributes to an element like using jq, such as

$('#select1').attr('disabled','disabled')

This method can also be implemented, but if you can use vue in vue, try not to use jq

Use the vue method to add properties like this:

<select v-model='issues' class="ui dropdown t-select-list" :disabled='isDisabled'>
 <option></option>
</selected>

Disabled is a native attribute of form elements. You can directly use the syntax of property binding:disabled to bind. Then add a condition to control the dynamic addition and deletion of this attribute, such as:

watch:{
 issueDatas(){
  if(==5){
   =true;
  }
 }
}

When the state is 5, select can be read-only

The above method of dynamically binding form elements in vue is all the content I share with you. I hope you can give you a reference and I hope you support me more.