options.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. declare type InternalComponentOptions = {
  2. _isComponent: true,
  3. parent: Component,
  4. propsData: ?Object,
  5. _parentVnode: VNode,
  6. _parentListeners: ?Object,
  7. _renderChildren: ?VNodeChildren,
  8. _componentTag: ?string,
  9. render?: Function,
  10. staticRenderFns?: Array<Function>
  11. }
  12. declare type ComponentOptions = {
  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?: {
  25. [key: string]: Function
  26. },
  27. watch?: {
  28. [key: string]: Function | string
  29. },
  30. // DOM
  31. el?: string | Element,
  32. template?: string,
  33. render: () => VNode,
  34. staticRenderFns?: Array<() => VNode>,
  35. // lifecycle
  36. init?: Function,
  37. created?: Function,
  38. beforeMount?: Function,
  39. mounted?: Function,
  40. beforeUpdate?: Function,
  41. updated?: Function,
  42. // assets
  43. directives?: { [key: string]: Object },
  44. components?: { [key: string]: Class<Component> },
  45. transitions?: { [key: string]: Object },
  46. filters?: { [key: string]: Function },
  47. // misc
  48. parent?: Component,
  49. mixins?: Array<Object>,
  50. name?: string,
  51. extends?: Class<Component> | Object,
  52. delimiters?: [string, string],
  53. // private
  54. _isComponent?: true,
  55. _propKeys?: Array<string>,
  56. _parentVnode?: VNode,
  57. _parentListeners?: ?{ [key: string]: Function | Array<Function> },
  58. _renderChildren?: ?VNodeChildren
  59. }
  60. declare type PropOptions = {
  61. type: Function | Array<Function> | null,
  62. default: any,
  63. required: ?boolean,
  64. validator: ?Function
  65. }