options.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. // 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. }