How to add dynamically attribute in VueJs

后端 未结 3 1601
花落未央
花落未央 2020-12-09 01:12

I\'m using vuejs and I wanna know how to have control on inputs (add disabled attribute when necessary). Is there any way to add dynamically attribute in vuejs ? Below my

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-09 02:02

    You can bind it to a variable using v-bind:disabled="foo" or :disabled="foo" for short:

    
    

    Then in Vue you can just set this.myVar = true and it will disable the input.

    Edit: add this to your template:

    
    

提交回复
热议问题