@lily
In Vue.js, you can disable a button by using the v-bind
directive to bind the disabled
attribute to a boolean variable that determines whether the button should be disabled or not. Here's an example:
1 2 3 4 5 |
data() { return { isButtonDisabled: true } } |
1
|
<button v-bind:disabled="isButtonDisabled">Click me</button> |
1
|
this.isButtonDisabled = true; |
And to enable the button, you can set the isButtonDisabled
variable to false
:
1
|
this.isButtonDisabled = false; |
This will toggle the disabled state of the button based on the value of the isButtonDisabled
variable.