I just can't seem to get this simple button toggle working properly. I have a button that starts with the text "Pause" and when clicked, it should change to "Resume". However, while it changes to "Resume" initially, it never toggles back to "Pause" when clicked again.
What am I missing here?
Here's my code:
<button class="btn btn-primary btn-block" v-on:click="pauseTask" type="button" role="button" id="" aria-expanded="false" style=" color: #6c757d border:none; border-radius: .15;">
{{ pauseButton.text }}
</button>
Vue
data() {
return {
pauseButton: {
text:'Pause'
},
isOpen: true
}
},
pauseTask: function() {
this.isOpen = !this.isOpen;
this.pauseButton.text = app.isOpen ? 'Pause' : 'Resume';
},