grip
grip
NNuxt
Created by grip on 12/19/2024 in #❓・help
Set ref in useAsyncData
in nuxt2 with the @nuxtjs/composition-api plugin i was able to do this:
const foo = ref(null)

useFetch(() => {
const data = await fetchData()

foo.value = data
})
const foo = ref(null)

useFetch(() => {
const data = await fetchData()

foo.value = data
})
is there a way to set some refs inside setup when fetching in nuxt 3? or do i have to refactor all of my useFetch usages?
26 replies
NNuxt
Created by grip on 12/16/2024 in #❓・help
how to add ld+json scripts in nuxt3
in nuxt 2 i had these entries in my head in nuxt config script: [ { type: 'application/ld+json', json: { '@context': 'https://schema.org', '@type': 'Organization', url: 'https://example.com', logo: 'https://example.com/static/logo-square.png' } }, { type: 'application/ld+json', json: { '@context': 'https://schema.org', '@type': 'WebSite', url: 'https://example.com', logo: 'https://example.com/static/logo-square.png', potentialAction: { '@type': 'SearchAction', target: { '@type': 'EntryPoint', urlTemplate: 'https://example.com/cars/?q={search_term_string}&from-search-engine=1' }, 'query-input': 'required name=search_term_string' } } } ] how can i add them in nuxt3?
14 replies
NNuxt
Created by grip on 12/11/2024 in #❓・help
Migrating nuxt2 to nuxt3 vuex store
Hi im migrating an app from nuxt2 to nuxt3. It currently uses vuex and im trying to move to nuxt3 without moving to pinia yet. The problem is that in nuxt2, the store uses a lot of this.$injectedProperty in its actions. How can i use the nuxtApp injected properties in vuex in nuxt 3?
34 replies
NNuxt
Created by grip on 11/25/2024 in #❓・help
Dynamically add routes in runtime based on pinia store value
I want to dynamically add some protected admin routes on my app only for the admin user type. the admin user type is evaluated server side in a plugin. can i use router.addRoutes there? for my routes i dont use the file system routing but the router.options.ts method instead
15 replies
NNuxt
Created by grip on 6/4/2024 in #❓・help
Third-party script hydration mismatch
Hey, I have a third-party script for my CMP which modifies part of the <body> to add the elements required to show the cookie banner. The script is loaded with async and defer. When these elements are added, I get a hydration error. Using the app:mounted hook or some fixed timeout to show the banner is a solution but then i get a hit in LCP. Any recommendations on how to approach this? thanks!
5 replies
NNuxt
Created by grip on 5/16/2024 in #❓・help
Prerender specific page/route components
Hey there, I have a page with static content but a dynamic header and footer. Is there any way to pre-render only the content part of the page which is located in a separate component while normally using SSR for the rest of the layout? Thanks!
1 replies