options.js 2.1 KB

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