N
Nuxt7mo ago
serafina

useAsyncData + pinia store field

There is such a situation: 1. Component.vue: <script setup> const { localData} = storeToRefs(piniaStore()); await useAsyncData(async () => piniaStore().init()); </script> <template> <div v-if=“localeData?.length”></div> </template> 2. Store: const localData = ref<null | string[]> const getLocalData() = async () => { const { data } = $fetch() (This is where everything comes in and in the project console I can see data, but the value is not set and therefore there is nothing on the page, there is a v-if) localData.value = data; } const init = async () => Promise.all([getLocalData()]) The question is, what is it? Maybe I can read something, I've already reread the docks three times on useAsyncData, but the watch cases there don't suit me, because I set the store field, but it always remains empty.
1 Reply
Likonima
Likonima7mo ago
might help to share the full code properly formatted
Want results from more Discord servers?
Add your server