options.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. declare type InternalComponentOptions = {
  2. _isComponent: true;
  3. parent: Component;
  4. propsData: ?Object;
  5. _parentVnode: VNode;
  6. _parentListeners: ?Object;
  7. _renderChildren: ?Array<VNode>;
  8. _componentTag: ?string;
  9. _parentElm: ?Node;
  10. _refElm: ?Node;
  11. render?: Function;
  12. staticRenderFns?: Array<Function>
  13. };
  14. type InjectKey = string | Symbol;
  15. declare type ComponentOptions = {
  16. // data
  17. data: Object | Function | void;
  18. props?: { [key: string]: PropOptions };
  19. propsData?: ?Object;
  20. computed?: {
  21. [key: string]: Function | {
  22. get?: Function;
  23. set?: Function;
  24. cache?: boolean
  25. }
  26. };
  27. methods?: { [key: string]: Function };
  28. watch?: { [key: string]: Function | string };
  29. // DOM
  30. el?: string | Element;
  31. template?: string;
  32. render: (h: () => VNode) => VNode;
  33. renderError?: (h: () => VNode, err: Error) => VNode;
  34. staticRenderFns?: Array<() => VNode>;
  35. // lifecycle
  36. beforeCreate?: Function;
  37. created?: Function;
  38. beforeMount?: Function;
  39. mounted?: Function;
  40. beforeUpdate?: Function;
  41. updated?: Function;
  42. activated?: Function;
  43. deactivated?: Function;
  44. beforeDestroy?: Function;
  45. destroyed?: Function;
  46. errorCaptured?: () => boolean | void;
  47. // assets
  48. directives?: { [key: string]: Object };
  49. components?: { [key: string]: Class<Component> };
  50. transitions?: { [key: string]: Object };
  51. filters?: { [key: string]: Function };
  52. // context
  53. provide?: { [key: string | Symbol]: any } | () => { [key: string | Symbol]: any };
  54. inject?: { [key: string]: InjectKey | { from?: InjectKey, default?: any }} | Array<string>;
  55. // component v-model customization
  56. model?: {
  57. prop?: string;
  58. event?: string;
  59. };
  60. // misc
  61. parent?: Component;
  62. mixins?: Array<Object>;
  63. name?: string;
  64. extends?: Class<Component> | Object;
  65. delimiters?: [string, string];
  66. comments?: boolean;
  67. inheritAttrs?: boolean;
  68. // private
  69. _isComponent?: true;
  70. _propKeys?: Array<string>;
  71. _parentVnode?: VNode;
  72. _parentListeners?: ?Object;
  73. _renderChildren?: ?Array<VNode>;
  74. _componentTag: ?string;
  75. _scopeId: ?string;
  76. _base: Class<Component>;
  77. _parentElm: ?Node;
  78. _refElm: ?Node;
  79. };
  80. declare type PropOptions = {
  81. type: Function | Array<Function> | null;
  82. default: any;
  83. required: ?boolean;
  84. validator: ?Function;
  85. }