2016-05-14 06:30:04 +08:00
|
|
|
import type { Config } from '../src/core/config'
|
|
|
|
import type VNode from '../src/core/vdom/vnode'
|
2016-05-15 03:49:18 +08:00
|
|
|
import type { ComponentDef } from '../src/core/vdom/create-element'
|
2016-05-14 06:30:04 +08:00
|
|
|
import type Watcher from '../src/core/observer/watcher'
|
|
|
|
|
|
|
|
declare interface Component {
|
|
|
|
// constructor information
|
|
|
|
static cid: number;
|
|
|
|
static options: Object;
|
|
|
|
// extend
|
|
|
|
static extend: (options: Object) => Function;
|
|
|
|
// assets
|
|
|
|
static directive: (id: string, def?: Function | Object) => Function | Object | void;
|
|
|
|
static component: (id: string, def?: Class<Component> | Object) => Class<Component>;
|
|
|
|
static transition: (id: string, def?: Object) => Object | void;
|
|
|
|
static filter: (id: string, def?: Function) => Function | void;
|
|
|
|
|
|
|
|
// public properties
|
|
|
|
$el: Element | void;
|
|
|
|
$data: Object;
|
2016-05-14 16:10:48 +08:00
|
|
|
$options: ComponentOptions;
|
2016-05-14 06:30:04 +08:00
|
|
|
$parent: Component | void;
|
|
|
|
$root: Component;
|
|
|
|
$children: Array<Component>;
|
|
|
|
$refs: { [key: string]: Component | Element | Array<Component | Element> | void };
|
|
|
|
$slots: { [key: string]: Array<VNode> };
|
|
|
|
$isServer: boolean;
|
|
|
|
|
|
|
|
// public methods
|
|
|
|
$mount: (el?: Element | string) => Component;
|
|
|
|
$forceUpdate: () => void;
|
|
|
|
$destroy: () => void;
|
|
|
|
$watch: (expOrFn: string | Function, cb: Function, options?: Object) => Function;
|
|
|
|
$on: (event: string, fn: Function) => Component;
|
|
|
|
$once: (event: string, fn: Function) => Component;
|
|
|
|
$off: (event?: string, fn?: Function) => Component;
|
|
|
|
$emit: (event: string, ...args: Array<any>) => Component;
|
|
|
|
$nextTick: (fn: Function) => void;
|
|
|
|
$createElement: (
|
|
|
|
tag?: string | Component,
|
|
|
|
data?: Object,
|
2016-05-14 15:08:21 +08:00
|
|
|
children?: VNodeChildren,
|
2016-05-14 06:30:04 +08:00
|
|
|
namespace?: string
|
|
|
|
) => VNode;
|
|
|
|
|
|
|
|
// private properties
|
|
|
|
_uid: number;
|
|
|
|
_isVue: true;
|
|
|
|
_renderProxy: Component;
|
|
|
|
_watcher: Watcher;
|
|
|
|
_watchers: Array<Watcher>;
|
|
|
|
_data: Object;
|
|
|
|
_events: Object;
|
|
|
|
_isMounted: boolean;
|
|
|
|
_isDestroyed: boolean;
|
|
|
|
_isBeingDestroyed: boolean;
|
|
|
|
_vnode: ?VNode;
|
|
|
|
_staticTrees: ?Array<VNode>;
|
|
|
|
|
|
|
|
// private methods
|
|
|
|
// lifecycle
|
|
|
|
_mount: () => Component;
|
|
|
|
_update: (vnode: VNode) => void;
|
|
|
|
_updateFromParent: (
|
2016-05-14 15:08:21 +08:00
|
|
|
propsData: ?Object,
|
|
|
|
listeners: ?{ [key: string]: Function | Array<Function> },
|
2016-05-14 06:30:04 +08:00
|
|
|
parentVnode: VNode,
|
2016-05-14 15:08:21 +08:00
|
|
|
renderChildren: ?VNodeChildren
|
2016-05-14 06:30:04 +08:00
|
|
|
) => void;
|
|
|
|
// rendering
|
|
|
|
_render: () => VNode;
|
|
|
|
__patch__: (a: Element | VNode | void, b: VNode) => Element;
|
2016-05-15 03:49:18 +08:00
|
|
|
__r__: (
|
|
|
|
vnode?: VNode | ComponentDef,
|
|
|
|
children?: VNodeChildren
|
|
|
|
) => VNode;
|
|
|
|
__s__: (
|
2016-05-14 06:30:04 +08:00
|
|
|
tag?: string | Component | Object,
|
|
|
|
data?: Object,
|
|
|
|
namespace?: string
|
2016-05-15 03:49:18 +08:00
|
|
|
) => VNode | ComponentDef | void;
|
|
|
|
__t__: (
|
|
|
|
str?: string
|
|
|
|
) => string;
|
|
|
|
__m__: (
|
|
|
|
index?: number
|
|
|
|
) => Object | void;
|
2016-05-14 06:30:04 +08:00
|
|
|
__toString__: (value: any) => string;
|
|
|
|
__resolveFilter__: (id: string) => Function;
|
|
|
|
__renderList__: (
|
|
|
|
val: any,
|
|
|
|
render: Function
|
|
|
|
) => ?Array<VNode>;
|
|
|
|
__registerRef__: (
|
|
|
|
key: string,
|
|
|
|
ref: Component | Element,
|
|
|
|
vFor: boolean,
|
|
|
|
isRemoval: boolean
|
|
|
|
) => void;
|
|
|
|
|
|
|
|
// allow dynamic method registration
|
|
|
|
[key: string]: any
|
|
|
|
}
|