A
A
asferot2018-12-26 11:21:52
Vue.js
asferot, 2018-12-26 11:21:52

How to remove the disabled button from the button when clicking on an object?

How can I make a button disabled by default, but when clicking on another object, the button becomes active?
If the user clicks on this object,

<tr v-for="product in products" @click="addToCart(product)" class="table-active">

then the button becomes active
<button :disabled>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Proskurin, 2018-12-26
@asferot

Create a buttonDisabled property with a value of false, write in the template
and when you need to unblock the button, just write buttonDisabled=false, when the block is true. So add to the addToCart method
this.buttonDisabled=false;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question