vue.d.ts 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import {
  2. ComponentOptions,
  3. FunctionalComponentOptions,
  4. WatchOptions,
  5. WatchHandler,
  6. DirectiveOptions,
  7. DirectiveFunction
  8. } from "./options.d";
  9. import { VNode, VNodeData, VNodeChildren } from "./vnode";
  10. import { PluginFunction, PluginObject } from "./plugin";
  11. export declare class Vue {
  12. constructor(options?: ComponentOptions<Vue>);
  13. $data: Object;
  14. readonly $el: HTMLElement;
  15. readonly $options: ComponentOptions<this>;
  16. readonly $parent: Vue;
  17. readonly $root: Vue;
  18. readonly $children: Vue[];
  19. readonly $refs: { [key: string]: Vue };
  20. readonly $slots: { [key: string]: VNode[] };
  21. readonly $isServer: boolean;
  22. $mount(elementOrSelector?: Element | String, hydrating?: boolean): this;
  23. $forceUpdate(): void;
  24. $destroy(): void;
  25. $set: typeof Vue.set;
  26. $delete: typeof Vue.delete;
  27. $watch(
  28. expOrFn: string | Function,
  29. callback: WatchHandler<this>,
  30. options?: WatchOptions
  31. ): (() => void);
  32. $on(event: string, callback: Function): this;
  33. $once(event: string, callback: Function): this;
  34. $off(event?: string, callback?: Function): this;
  35. $emit(event: string, ...args: any[]): this;
  36. $nextTick(callback?: (this: this) => void): void;
  37. $createElement(
  38. tag?: string | Vue,
  39. data?: VNodeData,
  40. children?: VNodeChildren,
  41. namespace?: string
  42. ): VNode;
  43. static config: {
  44. silent: boolean;
  45. optionMergeStrategies: any;
  46. devtools: boolean;
  47. errorHandler(err: Error, vm: Vue): void;
  48. keyCodes: { [key: string]: number };
  49. }
  50. static extend(options: ComponentOptions<Vue>): typeof Vue;
  51. static nextTick(callback: () => void, context?: any[]): void;
  52. static set<T>(object: Object, key: string, value: T): T;
  53. static set<T>(array: T[], key: number, value: T): T;
  54. static delete(object: Object, key: string): void;
  55. static directive(
  56. id: string,
  57. definition?: DirectiveOptions | DirectiveFunction
  58. ): DirectiveOptions;
  59. static filter(id: string, definition?: Function): Function;
  60. static component(
  61. id: string,
  62. definition?: ComponentOptions<Vue> | FunctionalComponentOptions | typeof Vue
  63. ): typeof Vue;
  64. static use<T>(plugin: PluginObject<T> | PluginFunction<T>, options?: T): void;
  65. static mixin(mixin: typeof Vue | ComponentOptions<Vue>): void;
  66. static compile(template: string): {
  67. render(createElement: typeof Vue.prototype.$createElement): VNode;
  68. staticRenderFns: (() => VNode)[];
  69. };
  70. }