options.js 2.1 KB

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