I have a vue project where I'm loading an array on page load and looking at the line item of each, checking the status and trying to show a button for each status with a 3-way toggle.
I think I have the main idea right but the structure is off with the mounting and it being an array. I'm a bit stuck on how to fully get this working but quite simply I want only one button to show for each subItem row based on status.
If subItem status = 'A' I want a button that says Accept, if it's 'B' then pause, and if 'C' then resume. I need the toggle to work and I can then work on calling an axios call based on the status, but I think I just need this working first to get the idea.
subItems is an array like this:
array(2)
0:
id: 123,
status: 'A'
1:
id: 234,
status: 'B'
This is my template/vue code:
<div class="row" v-for="(subItem, key) in subItems" v-cloak>
<button :class="['btn', 'btn-block', subItem.status == 'H' ? 'accept' : 'resume' : 'pause']" :style="{ border:none, borderRadius: .15 }" v-on:click="pause(subItem)" type="button" role="button" id="" aria-expanded="false">
{{ subItem.status == 'A' ? 'Accept' : 'Resume' : 'Pause' }}
</button>
</div>
data() {
return {
subItems: [],
}
}
this.isOpenandthis.pauseButton?