options.js 1.3 KB

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