feat(core): keep-alive
This commit is contained in:
@@ -42,6 +42,7 @@ export interface FunctionalComponent<P = {}> {
|
||||
}
|
||||
|
||||
export type Component = ComponentOptions | FunctionalComponent
|
||||
export { ComponentOptions }
|
||||
|
||||
type LifecycleHook = Function[] | null
|
||||
|
||||
@@ -89,13 +90,10 @@ export interface ComponentInternalInstance {
|
||||
// after initialized (e.g. inline handlers)
|
||||
renderCache: (Function | VNode)[] | null
|
||||
|
||||
// assets for fast resolution
|
||||
components: Record<string, Component>
|
||||
directives: Record<string, Directive>
|
||||
|
||||
asyncDep: Promise<any> | null
|
||||
asyncResult: unknown
|
||||
asyncResolved: boolean
|
||||
|
||||
// the rest are only for stateful components
|
||||
renderContext: Data
|
||||
data: Data
|
||||
@@ -108,11 +106,17 @@ export interface ComponentInternalInstance {
|
||||
refs: Data
|
||||
emit: Emit
|
||||
|
||||
// user namespace
|
||||
user: { [key: string]: any }
|
||||
// suspense related
|
||||
asyncDep: Promise<any> | null
|
||||
asyncResult: unknown
|
||||
asyncResolved: boolean
|
||||
|
||||
// storage for any extra properties
|
||||
sink: { [key: string]: any }
|
||||
|
||||
// lifecycle
|
||||
isUnmounted: boolean
|
||||
isDeactivated: boolean
|
||||
[LifecycleHooks.BEFORE_CREATE]: LifecycleHook
|
||||
[LifecycleHooks.CREATED]: LifecycleHook
|
||||
[LifecycleHooks.BEFORE_MOUNT]: LifecycleHook
|
||||
@@ -173,11 +177,13 @@ export function createComponentInstance(
|
||||
asyncResolved: false,
|
||||
|
||||
// user namespace for storing whatever the user assigns to `this`
|
||||
user: {},
|
||||
// can also be used as a wildcard storage for ad-hoc injections internally
|
||||
sink: {},
|
||||
|
||||
// lifecycle hooks
|
||||
// not using enums here because it results in computed properties
|
||||
isUnmounted: false,
|
||||
isDeactivated: false,
|
||||
bc: null,
|
||||
c: null,
|
||||
bm: null,
|
||||
|
||||
Reference in New Issue
Block a user