options.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. declare type InternalComponentOptions = {
  2. _isComponent: true;
  3. parent: Component;
  4. _parentVnode: VNode;
  5. render?: Function;
  6. staticRenderFns?: Array<Function>
  7. };
  8. type InjectKey = string | Symbol;
  9. declare type ComponentOptions = {
  10. componentId?: string;
  11. // data
  12. data: Object | Function | void;
  13. props?: { [key: string]: PropOptions };
  14. propsData?: ?Object;
  15. computed?: {
  16. [key: string]: Function | {
  17. get?: Function;
  18. set?: Function;
  19. cache?: boolean
  20. }
  21. };
  22. methods?: { [key: string]: Function };
  23. watch?: { [key: string]: Function | string };
  24. // DOM
  25. el?: string | Element;
  26. template?: string;
  27. render: (h: () => VNode) => VNode;
  28. renderError?: (h: () => VNode, err: Error) => VNode;
  29. staticRenderFns?: Array<() => VNode>;
  30. // lifecycle
  31. beforeCreate?: Function;
  32. created?: Function;
  33. beforeMount?: Function;
  34. mounted?: Function;
  35. beforeUpdate?: Function;
  36. updated?: Function;
  37. activated?: Function;
  38. deactivated?: Function;
  39. beforeDestroy?: Function;
  40. destroyed?: Function;
  41. errorCaptured?: () => boolean | void;
  42. serverPrefetch?: Function;
  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. };
  74. declare type PropOptions = {
  75. type: Function | Array<Function> | null;
  76. default: any;
  77. required: ?boolean;
  78. validator: ?Function;
  79. }