vnode.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. declare type VNodeChildren = Array<?VNode | string | VNodeChildren> | string;
  2. declare type VNodeComponentOptions = {
  3. Ctor: Class<Component>;
  4. propsData: ?Object;
  5. listeners: ?Object;
  6. children: ?Array<VNode>;
  7. tag?: string;
  8. };
  9. declare type MountedComponentVNode = {
  10. context: Component;
  11. componentOptions: VNodeComponentOptions;
  12. componentInstance: Component;
  13. parent: VNode;
  14. data: VNodeData;
  15. };
  16. // interface for vnodes in update modules
  17. declare type VNodeWithData = {
  18. tag: string;
  19. data: VNodeData;
  20. children: ?Array<VNode>;
  21. text: void;
  22. elm: any;
  23. ns: string | void;
  24. context: Component;
  25. key: string | number | void;
  26. parent?: VNodeWithData;
  27. componentInstance?: Component;
  28. isRootInsert: boolean;
  29. };
  30. declare interface VNodeData {
  31. key?: string | number;
  32. slot?: string;
  33. ref?: string;
  34. is?: string;
  35. pre?: boolean;
  36. tag?: string;
  37. staticClass?: string;
  38. class?: any;
  39. staticStyle?: { [key: string]: any };
  40. style?: Array<Object> | Object;
  41. normalizedStyle?: Object;
  42. props?: { [key: string]: any };
  43. attrs?: { [key: string]: string };
  44. domProps?: { [key: string]: any };
  45. hook?: { [key: string]: Function };
  46. on?: ?{ [key: string]: Function | Array<Function> };
  47. nativeOn?: { [key: string]: Function | Array<Function> };
  48. transition?: Object;
  49. show?: boolean; // marker for v-show
  50. inlineTemplate?: {
  51. render: Function;
  52. staticRenderFns: Array<Function>;
  53. };
  54. directives?: Array<VNodeDirective>;
  55. keepAlive?: boolean;
  56. scopedSlots?: { [key: string]: Function };
  57. model?: {
  58. value: any;
  59. callback: Function;
  60. };
  61. };
  62. declare type VNodeDirective = {
  63. name: string;
  64. rawName: string;
  65. value?: any;
  66. oldValue?: any;
  67. arg?: string;
  68. modifiers?: ASTModifiers;
  69. def?: Object;
  70. };
  71. declare type ScopedSlotsData = Array<{ key: string, fn: Function } | ScopedSlotsData>;