feat: onServerPrefetch (#3070)

Support equivalent of `serverPrefetch` option via Composition API.
This commit is contained in:
Guillaume Chau
2021-05-07 18:00:52 +02:00
committed by GitHub
parent 4aceec7b5e
commit 349eb0f0ad
6 changed files with 247 additions and 21 deletions

View File

@@ -40,7 +40,8 @@ import {
onDeactivated,
onRenderTriggered,
DebuggerHook,
ErrorCapturedHook
ErrorCapturedHook,
onServerPrefetch
} from './apiLifecycle'
import {
reactive,
@@ -555,6 +556,7 @@ export function applyOptions(
renderTracked,
renderTriggered,
errorCaptured,
serverPrefetch,
// public API
expose
} = options
@@ -798,6 +800,9 @@ export function applyOptions(
if (unmounted) {
onUnmounted(unmounted.bind(publicThis))
}
if (serverPrefetch) {
onServerPrefetch(serverPrefetch.bind(publicThis))
}
if (__COMPAT__) {
if (