Reputation: 1827
I have the following button that gets disabled if the user is in the first page:
<button :disabled="page==1" v-on:click="page=1;run()" class="page-link" :class="{'disabled' : disabled}">First</button>
However i would like to add the class .disabled
if said button is disabled by Vue. Is it possible to do this through Vue?
Upvotes: 3
Views: 2473
Reputation: 845
You can put the same condition directly to the class directive:
:class="{'disabled' : page === 1}"
Upvotes: 5
Reputation: 79
Try changing disabled to false in the onclick, something like this: v-on:click="page=1;run();!disabled"
or v-on:click="page=1;run();disabled=false"
.
Upvotes: -1