options.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. // assets
  43. directives?: { [key: string]: Object };
  44. components?: { [key: string]: Class<Component> };
  45. transitions?: { [key: string]: Object };
  46. filters?: { [key: string]: Function };
  47. // context
  48. provide?: { [key: string | Symbol]: any } | () => { [key: string | Symbol]: any };
  49. inject?: { [key: string]: InjectKey | { from?: InjectKey, default?: any }} | Array<string>;
  50. // component v-model customization
  51. model?: {
  52. prop?: string;
  53. event?: string;
  54. };
  55. // misc
  56. parent?: Component;
  57. mixins?: Array<Object>;
  58. name?: string;
  59. extends?: Class<Component> | Object;
  60. delimiters?: [string, string];
  61. comments?: boolean;
  62. inheritAttrs?: boolean;
  63. // private
  64. _isComponent?: true;
  65. _propKeys?: Array<string>;
  66. _parentVnode?: VNode;
  67. _parentListeners?: ?Object;
  68. _renderChildren?: ?Array<VNode>;
  69. _componentTag: ?string;
  70. _scopeId: ?string;
  71. _base: Class<Component>;
  72. };
  73. declare type PropOptions = {
  74. type: Function | Array<Function> | null;
  75. default: any;
  76. required: ?boolean;
  77. validator: ?Function;
  78. }