0👍
When you create a ref
without initial value it is undefined
by default. This also affects the type, so purchaseInfo
is actually Ref<PurchaseInfo | undefined>
.
So you just need a check in the template to handle the loading state, when purchaseInfo
has no value yet:
<template>
<table v-if="purchaseInfo">
<tr v-for="(item, index) in purchaseInfo.orderedItems" />
</table>
<div v-else>
You can put some loader here, or render nothing.
</div>
</template>
0👍
I wish I can say what fixed this. It looks like the compiler kept picking up on something bad and decided to start building fine.
- [Vuejs]-Laravel excel export works just 1 time
- [Vuejs]-My modal component in Vue3 doesn't remount on page change
Source:stackexchange.com