vue/flow/component.js

111 lines
3.8 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;
2016-06-25 22:43:19 +08:00
static superOptions: Object;
static extendOptions: Object;
static super: Class<Component>;
// assets
static directive: (id: string, def?: Function | Object) => Function | Object | void;
static component: (id: string, def?: Class<Component> | Object) => Class<Component>;
static filter: (id: string, def?: Function) => Function | void;
// public properties
$el: any; // so that we can attach __vue__ to it
$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> };
$scopedSlots: { [key: string]: () => VNodeChildren };
$vnode: VNode;
$isServer: boolean;
// public methods
2016-06-02 06:20:13 +08:00
$mount: (el?: Element | string, hydrating?: boolean) => Component;
$forceUpdate: () => void;
$destroy: () => void;
$set: (obj: Array<mixed> | Object, key: mixed, val: mixed) => void;
$delete: (obj: Object, key: string) => 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<mixed>) => Component;
$nextTick: (fn: Function) => void;
2016-12-22 05:18:04 +08:00
$createElement: (tag?: string | Component, data?: Object, children?: VNodeChildren) => VNode;
// private properties
_uid: number;
_isVue: true;
_self: Component;
_renderProxy: Component;
_renderContext: ?Component;
_watcher: Watcher;
_watchers: Array<Watcher>;
_data: Object;
_events: Object;
2016-06-28 16:00:32 +08:00
_inactive: boolean;
_isMounted: boolean;
_isDestroyed: boolean;
_isBeingDestroyed: boolean;
_vnode: ?VNode;
_staticTrees: ?Array<VNode>;
2016-12-14 10:01:12 +08:00
_hasHookEvent: boolean;
// private methods
// lifecycle
2016-05-17 21:58:24 +08:00
_init: Function;
2016-06-02 06:20:13 +08:00
_mount: (el?: Element | void, hydrating?: boolean) => Component;
_update: (vnode: VNode, hydrating?: boolean) => void;
_updateFromParent: (
2016-05-14 15:08:21 +08:00
propsData: ?Object,
listeners: ?{ [key: string]: Function | Array<Function> },
parentVnode: VNode,
2016-12-05 00:34:53 +08:00
renderChildren: ?Array<VNode>
) => void;
// rendering
_render: () => VNode;
__patch__: (a: Element | VNode | void, b: VNode) => any;
// createElement
2016-12-22 05:18:04 +08:00
// _c is internal that accepts `normalizationType` optimization hint
_c: (vnode?: VNode, data?: VNodeData, children?: VNodeChildren, normalizationType?: number) => VNode | void;
// renderStatic
_m: (index: number, isInFor?: boolean) => VNode | VNodeChildren;
2016-11-03 10:34:36 +08:00
// markOnce
_o: (vnode: VNode | Array<VNode>, index: number, key: string) => VNode | VNodeChildren;
// toString
_s: (value: mixed) => string;
// text to VNode
_v: (value: string | number) => VNode;
// toNumber
_n: (value: string) => number | string;
// empty vnode
_e: () => VNode;
// loose equal
_q: (a: mixed, b: mixed) => boolean;
// loose indexOf
_i: (arr: Array<mixed>, val: mixed) => number;
// resolveFilter
_f: (id: string) => Function;
// renderList
_l: (val: mixed, render: Function) => ?Array<VNode>;
// renderSlot
2016-11-17 11:05:04 +08:00
_t: (name: string, fallback: ?Array<VNode>, props: ?Object) => ?Array<VNode>;
2016-05-25 08:41:06 +08:00
// apply v-bind object
_b: (data: any, value: any, asProp?: boolean) => VNodeData;
// check custom keyCode
_k: (eventKeyCode: number, key: string, builtInAlias: number | Array<number> | void) => boolean;
// allow dynamic method registration
[key: string]: any
}