mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 01:17:16 +00:00
fix(nuxt3): add app:suspense:resolve
hooks (#2937)
This commit is contained in:
parent
b449d0bfb9
commit
00e8a6e9d4
@ -48,7 +48,7 @@ if (process.client) {
|
|||||||
await nuxt.hooks.callHook('app:created', vueApp)
|
await nuxt.hooks.callHook('app:created', vueApp)
|
||||||
await nuxt.hooks.callHook('app:beforeMount', vueApp)
|
await nuxt.hooks.callHook('app:beforeMount', vueApp)
|
||||||
|
|
||||||
nuxt.hooks.hookOnce('page:finish', () => {
|
nuxt.hooks.hookOnce('app:suspense:resolve', () => {
|
||||||
nuxt.isHydrating = false
|
nuxt.isHydrating = false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<Suspense>
|
<Suspense @resolve="onResolve">
|
||||||
<App />
|
<App />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
</template>
|
</template>
|
||||||
@ -14,6 +14,9 @@ export default {
|
|||||||
if (process.dev && results && results.some(i => i && 'then' in i)) {
|
if (process.dev && results && results.some(i => i && 'then' in i)) {
|
||||||
console.error('[nuxt] Error in `vue:setup`. Callbacks must be synchronous.')
|
console.error('[nuxt] Error in `vue:setup`. Callbacks must be synchronous.')
|
||||||
}
|
}
|
||||||
|
return {
|
||||||
|
onResolve: () => nuxtApp.callHook('app:suspense:resolve')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -20,6 +20,7 @@ export interface RuntimeNuxtHooks {
|
|||||||
'app:beforeMount': (app: App<Element>) => HookResult
|
'app:beforeMount': (app: App<Element>) => HookResult
|
||||||
'app:mounted': (app: App<Element>) => HookResult
|
'app:mounted': (app: App<Element>) => HookResult
|
||||||
'app:rendered': () => HookResult
|
'app:rendered': () => HookResult
|
||||||
|
'app:suspense:resolve': (Component?: VNode) => HookResult
|
||||||
'page:start': (Component?: VNode) => HookResult
|
'page:start': (Component?: VNode) => HookResult
|
||||||
'page:finish': (Component?: VNode) => HookResult
|
'page:finish': (Component?: VNode) => HookResult
|
||||||
'meta:register': (metaRenderers: Array<(nuxt: NuxtApp) => NuxtMeta | Promise<NuxtMeta>>) => HookResult
|
'meta:register': (metaRenderers: Array<(nuxt: NuxtApp) => NuxtMeta | Promise<NuxtMeta>>) => HookResult
|
||||||
|
Loading…
Reference in New Issue
Block a user