One of the challenges I am facing involves toggling a pair of buttons based on the response received from an API. These buttons need to be set only once when the page initially loads.
https://i.sstatic.net/bMgmE.png
Below is the code snippet I am currently utilizing:
<div class="small-7 column btn-switch">
<span class="switch-statement">"Is it mandatory"</span>
<button
:class="!isMandatory ? 'button--secondary' : 'button--tertiary'"
class="button button-border"
@click="setMandatory(false)"
>
"No"
</button>
<button
:class="isMandatory ? 'button--secondary' : 'button--tertiary'"
class="button"
role=`your text`"button"
@click="setisMandatory(true)"
>
"Yes"
</button>
</div>
I attempted to use v-if to control the visibility of the buttons but unfortunately it did not yield the desired result. Are there any alternative methods that can be suggested for achieving this functionality?