| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- import { Vue } from "./vue";
- import { VNode, VNodeData, VNodeDirective } from "./vnode";
- type Constructor = {
- new (...args: any[]): any;
- }
- type $createElement = typeof Vue.prototype.$createElement;
- export interface ComponentOptions<V extends Vue> {
- data?: Object | ((this: V) => Object);
- props?: string[] | { [key: string]: PropOptions | Constructor | Constructor[] };
- propsData?: Object;
- computed?: { [key: string]: ((this: V) => any) | ComputedOptions<V> };
- methods?: { [key: string]: Function };
- watch?: { [key: string]: ({ handler: WatchHandler<V> } & WatchOptions) | WatchHandler<V> | string };
- el?: Element | String;
- template?: string;
- render?(this: V, createElement: $createElement): VNode;
- staticRenderFns?: ((createElement: $createElement) => VNode)[];
- beforeCreate?(this: V): void;
- created?(this: V): void;
- beforeDestroy?(this: V): void;
- destroyed?(this: V): void;
- beforeMount?(this: V): void;
- mounted?(this: V): void;
- beforeUpdate?(this: V): void;
- updated?(this: V): void;
- directives?: { [key: string]: DirectiveOptions | DirectiveFunction };
- components?: { [key: string]: ComponentOptions<Vue> | FunctionalComponentOptions | typeof Vue };
- transitions?: { [key: string]: Object };
- filters?: { [key: string]: Function };
- parent?: Vue;
- mixins?: (ComponentOptions<Vue> | typeof Vue)[];
- name?: string;
- extends?: ComponentOptions<Vue> | typeof Vue;
- delimiters?: [string, string];
- }
- export interface FunctionalComponentOptions {
- props?: string[] | { [key: string]: PropOptions | Constructor | Constructor[] };
- functional: boolean;
- render(this: never, createElement: $createElement, context: RenderContext): VNode;
- name?: string;
- }
- export interface RenderContext {
- props: any;
- children: VNode[];
- slots: any;
- data: VNodeData;
- parent: Vue;
- }
- export interface PropOptions {
- type?: Constructor | Constructor[] | null;
- required?: boolean;
- default?: any;
- validator?(value: any): boolean;
- }
- export interface ComputedOptions<V> {
- get?(this: V): any;
- set?(this: V, value: any): void;
- cache?: boolean;
- }
- export type WatchHandler<V> = (this: V, val: any, oldVal: any) => void;
- export interface WatchOptions {
- deep?: boolean;
- immediate?: boolean;
- }
- export type DirectiveFunction = (
- el: HTMLElement,
- binding: VNodeDirective,
- vnode: VNode,
- oldVnode: VNode
- ) => void;
- export interface DirectiveOptions {
- bind?: DirectiveFunction;
- inserted?: DirectiveFunction;
- update?: DirectiveFunction;
- componentUpdated?: DirectiveFunction;
- unbind?: DirectiveFunction;
- }
|