[Vuejs]-How to disable button if there is no data in Vuejs?

0👍

You can fix it by completely removing the variable this.disableButton, instead, use a function:

getSubmitDisabled() {
     return this.user.password.length<8 || 
         this.$v.user.password.$error ||
         this.user.password!==this.user.confirmPassword; 
},

Then you can use it like this:

<button :disabled="getSubmitDisabled()">

Leave a comment