options.js 1.5 KB

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