How to disable input conditionally in vue.js

后端 未结 11 1268
余生分开走
余生分开走 2020-12-07 10:11

I have an input:



        
11条回答
  •  北荒
    北荒 (楼主)
    2020-12-07 10:38

    You can manipulate :disabled attribute in vue.js.

    It will accept a boolean, if it's true, then the input gets disabled, otherwise it will be enabled...

    Something like structured like below in your case for example:

    
    

    Also read this below:

    Conditionally Disabling Input Elements via JavaScript Expression

    You can conditionally disable input elements inline with a JavaScript expression. This compact approach provides a quick way to apply simple conditional logic. For example, if you only needed to check the length of the password, you may consider doing something like this.

    Change Your Password

提交回复
热议问题