mirror of
https://github.com/vuejs/vue.git
synced 2024-11-22 04:39:46 +00:00
661bfe552e
Update the `_init` and `_update` logic to partially support lifecycles. Add test cases for testing the lifecycle hooks and data update.
94 lines
2.1 KiB
JavaScript
94 lines
2.1 KiB
JavaScript
declare type InternalComponentOptions = {
|
|
_isComponent: true;
|
|
parent: Component;
|
|
_parentVnode: VNode;
|
|
_parentElm: ?Node;
|
|
_refElm: ?Node;
|
|
render?: Function;
|
|
staticRenderFns?: Array<Function>
|
|
};
|
|
|
|
type InjectKey = string | Symbol;
|
|
|
|
declare type ComponentOptions = {
|
|
componentId?: string;
|
|
|
|
// data
|
|
data: Object | Function | void;
|
|
props?: { [key: string]: PropOptions };
|
|
propsData?: ?Object;
|
|
computed?: {
|
|
[key: string]: Function | {
|
|
get?: Function;
|
|
set?: Function;
|
|
cache?: boolean
|
|
}
|
|
};
|
|
methods?: { [key: string]: Function };
|
|
watch?: { [key: string]: Function | string };
|
|
|
|
// DOM
|
|
el?: string | Element;
|
|
template?: string;
|
|
render: (h: () => VNode) => VNode;
|
|
renderError?: (h: () => VNode, err: Error) => VNode;
|
|
staticRenderFns?: Array<() => VNode>;
|
|
|
|
// lifecycle
|
|
beforeCreate?: Function;
|
|
created?: Function;
|
|
beforeMount?: Function;
|
|
mounted?: Function;
|
|
beforeUpdate?: Function;
|
|
updated?: Function;
|
|
activated?: Function;
|
|
deactivated?: Function;
|
|
beforeDestroy?: Function;
|
|
destroyed?: Function;
|
|
errorCaptured?: () => boolean | void;
|
|
|
|
// assets
|
|
directives?: { [key: string]: Object };
|
|
components?: { [key: string]: Class<Component> };
|
|
transitions?: { [key: string]: Object };
|
|
filters?: { [key: string]: Function };
|
|
|
|
// context
|
|
provide?: { [key: string | Symbol]: any } | () => { [key: string | Symbol]: any };
|
|
inject?: { [key: string]: InjectKey | { from?: InjectKey, default?: any }} | Array<string>;
|
|
|
|
// component v-model customization
|
|
model?: {
|
|
prop?: string;
|
|
event?: string;
|
|
};
|
|
|
|
// misc
|
|
parent?: Component;
|
|
mixins?: Array<Object>;
|
|
name?: string;
|
|
extends?: Class<Component> | Object;
|
|
delimiters?: [string, string];
|
|
comments?: boolean;
|
|
inheritAttrs?: boolean;
|
|
|
|
// private
|
|
_isComponent?: true;
|
|
_propKeys?: Array<string>;
|
|
_parentVnode?: VNode;
|
|
_parentListeners?: ?Object;
|
|
_renderChildren?: ?Array<VNode>;
|
|
_componentTag: ?string;
|
|
_scopeId: ?string;
|
|
_base: Class<Component>;
|
|
_parentElm: ?Node;
|
|
_refElm: ?Node;
|
|
};
|
|
|
|
declare type PropOptions = {
|
|
type: Function | Array<Function> | null;
|
|
default: any;
|
|
required: ?boolean;
|
|
validator: ?Function;
|
|
}
|