I want a vue js v3 project using composition api, I have declared a variable like this
setup() {
const showInvoiceItemForm = true;
return { showInvoiceItemForm };
},
Now I want to display a form when a button is clicked and a function is called like this
<form @submit.prevent="submit">
<InvoiceItem
:form="form"
v-if="this.showInvoiceItemForm"
></InvoiceItem>
<div class="mt-20 flex flex-row justify-between space-x-8">
<BreezeButton type="button" @click="addInvoiceItem"
>Add Item</BreezeButton
>
<BreezeButton>Generate Invoice</BreezeButton>
</div>
</form>
And the method is like this
addInvoiceItem() {
this.showInvoiceItemForm = true;
console.log(this.showInvoiceItemForm);
},
From the console, I can see that the value of showInvoiceItemForm is set to true but the form is never shown. It looks like the value never really changes, so what is the proper way to use the composition api variable.