options.js 2.1 KB

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