index.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. import {
  2. /* eslint-disable no-unused-vars */
  3. Style,
  4. // locale
  5. Locale,
  6. // basic
  7. Button,
  8. Loading,
  9. Tip,
  10. Toolbar,
  11. TabBar,
  12. TabPanels,
  13. // form
  14. Checkbox,
  15. CheckboxGroup,
  16. Checker,
  17. Radio,
  18. RadioGroup,
  19. Input,
  20. Textarea,
  21. Select,
  22. Switch,
  23. Rate,
  24. Validator,
  25. Upload,
  26. Form,
  27. // popup
  28. Popup,
  29. Toast,
  30. Picker,
  31. CascadePicker,
  32. DatePicker,
  33. TimePicker,
  34. SegmentPicker,
  35. Dialog,
  36. ActionSheet,
  37. Drawer,
  38. ImagePreview,
  39. // scroll
  40. Scroll,
  41. Slide,
  42. IndexList,
  43. Swipe,
  44. Sticky,
  45. ScrollNav,
  46. ScrollNavBar,
  47. RecycleList,
  48. // module
  49. BetterScroll,
  50. createAPI
  51. } from './module'
  52. import { processComponentName } from './common/helpers/util'
  53. const components = [
  54. // locale
  55. Locale,
  56. // basic
  57. Button,
  58. Loading,
  59. Tip,
  60. Toolbar,
  61. TabBar,
  62. TabPanels,
  63. // form
  64. Checkbox,
  65. CheckboxGroup,
  66. Checker,
  67. Radio,
  68. RadioGroup,
  69. Input,
  70. Textarea,
  71. Select,
  72. Switch,
  73. Rate,
  74. Validator,
  75. Upload,
  76. Form,
  77. // popup
  78. Popup,
  79. Toast,
  80. Picker,
  81. CascadePicker,
  82. DatePicker,
  83. TimePicker,
  84. SegmentPicker,
  85. Dialog,
  86. ActionSheet,
  87. Drawer,
  88. ImagePreview,
  89. // scroll
  90. Scroll,
  91. Slide,
  92. IndexList,
  93. Swipe,
  94. Sticky,
  95. ScrollNav,
  96. ScrollNavBar,
  97. RecycleList
  98. ]
  99. function install(Vue) {
  100. if (install.installed) {
  101. return
  102. }
  103. install.installed = true
  104. components.forEach((Component) => {
  105. // ignore radio
  106. if (Component === Radio) {
  107. return
  108. }
  109. Component.install(Vue)
  110. })
  111. }
  112. const Cube = {
  113. /* eslint-disable no-undef */
  114. // version: __VERSION__,
  115. install,
  116. BScroll: BetterScroll,
  117. createAPI
  118. }
  119. components.forEach((Component) => {
  120. const name = processComponentName(Component, {
  121. firstUpperCase: true
  122. })
  123. Cube[name] = Component
  124. })
  125. if (typeof window !== 'undefined' && window.Vue) {
  126. window.Vue.use(install)
  127. }
  128. export default Cube