How to show a button whenever the checked a box is checked?
Tried to hide the button but i don't know how to show it when I checked at least one box.
<button data-toggle="tooltip"
hidden="hidden"
title="Save"
v-on:click="save">
<span >Submit ({{pr.selected.length}}) </span>
</button>
You need to store the value of the button visibility in your state
data() {
return {
visible: true
}
}
And then, rely your button on that state
<button v-if="visible">
and simply toggle the state
// to show
this.visible = true;
// to hide
this.visible = false;
add a computed property
computed: {
showButton() {
if (this.p.item.selected) {
return true;
}
return false;
}
}
And to your button
<button v-if="showButton"/>
or
<button :class="{'is-hidden-class': !showButton}"/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.