vue/flow/component.js

116 lines
3.1 KiB
JavaScript
Raw Normal View History

import type { Config } from '../src/core/config'
import type VNode from '../src/core/vdom/vnode'
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;
$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,
namespace?: string
) => VNode;
// private properties
_uid: number;
_isVue: true;
_self: Component;
_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
2016-05-17 21:58:24 +08:00
_init: Function;
_mount: () => Component;
_update: (vnode: VNode) => void;
2016-06-02 02:49:51 +08:00
_updateListeners: (listeners: Object, oldListeners: ?Object) => void;
_updateFromParent: (
2016-05-14 15:08:21 +08:00
propsData: ?Object,
listeners: ?{ [key: string]: Function | Array<Function> },
parentVnode: VNode,
2016-05-14 15:08:21 +08:00
renderChildren: ?VNodeChildren
) => void;
// rendering
_render: () => VNode;
__patch__: (a: Element | VNode | void, b: VNode) => Element;
// renderElementWithChildren
_h: (
2016-05-15 03:54:49 +08:00
vnode?: VNode,
children?: VNodeChildren
2016-05-15 03:54:49 +08:00
) => VNode | void;
// renderElement
_e: (
tag?: string | Component | Object,
data?: Object,
namespace?: string
2016-05-15 03:54:49 +08:00
) => VNode | void;
// renderText
_t: (
str?: string
) => string;
// renderStaticTree
_m: (
index?: number
) => Object | void;
// toString
_s: (value: any) => string;
// resolveFilter
_f: (id: string) => Function;
// renderList
_l: (
val: any,
render: Function
) => ?Array<VNode>;
// registerRef
_r: (
key: string,
ref: Component | Element,
vFor: boolean,
isRemoval: boolean
) => void;
2016-05-25 08:41:06 +08:00
// apply v-bind object
_b: (vnode: VNodeWithData, value: any) => void;
// allow dynamic method registration
[key: string]: any
}