@gmcb/uv-ui 0.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/CHANGELOG.md +295 -0
  2. package/LICENSE +21 -0
  3. package/README.md +164 -0
  4. package/components/uv-action-sheet/props.js +50 -0
  5. package/components/uv-action-sheet/uv-action-sheet.vue +280 -0
  6. package/components/uv-album/uv-album.vue +312 -0
  7. package/components/uv-alert/props.js +45 -0
  8. package/components/uv-alert/uv-alert.vue +246 -0
  9. package/components/uv-avatar/props.js +85 -0
  10. package/components/uv-avatar/uv-avatar.vue +182 -0
  11. package/components/uv-avatar-group/props.js +53 -0
  12. package/components/uv-avatar-group/uv-avatar-group.vue +106 -0
  13. package/components/uv-back-top/props.js +58 -0
  14. package/components/uv-back-top/uv-back-top.vue +116 -0
  15. package/components/uv-badge/props.js +73 -0
  16. package/components/uv-badge/uv-badge.vue +176 -0
  17. package/components/uv-button/nvue.scss +46 -0
  18. package/components/uv-button/props.js +163 -0
  19. package/components/uv-button/uv-button.vue +529 -0
  20. package/components/uv-button/vue.scss +93 -0
  21. package/components/uv-calendar/calendar.js +546 -0
  22. package/components/uv-calendar/header.vue +104 -0
  23. package/components/uv-calendar/month.vue +616 -0
  24. package/components/uv-calendar/props.js +145 -0
  25. package/components/uv-calendar/uv-calendar.vue +390 -0
  26. package/components/uv-calendars/calendar-body.vue +376 -0
  27. package/components/uv-calendars/calendar-item.vue +248 -0
  28. package/components/uv-calendars/calendar.js +546 -0
  29. package/components/uv-calendars/i18n/en.json +12 -0
  30. package/components/uv-calendars/i18n/index.js +8 -0
  31. package/components/uv-calendars/i18n/zh-Hans.json +12 -0
  32. package/components/uv-calendars/i18n/zh-Hant.json +12 -0
  33. package/components/uv-calendars/util.js +435 -0
  34. package/components/uv-calendars/uv-calendars.vue +452 -0
  35. package/components/uv-cell/props.js +116 -0
  36. package/components/uv-cell/uv-cell.vue +209 -0
  37. package/components/uv-cell-group/props.js +15 -0
  38. package/components/uv-cell-group/uv-cell-group.vue +63 -0
  39. package/components/uv-checkbox/props.js +70 -0
  40. package/components/uv-checkbox/uv-checkbox.vue +371 -0
  41. package/components/uv-checkbox-group/props.js +84 -0
  42. package/components/uv-checkbox-group/uv-checkbox-group.vue +119 -0
  43. package/components/uv-code/props.js +35 -0
  44. package/components/uv-code/uv-code.vue +136 -0
  45. package/components/uv-code-input/props.js +83 -0
  46. package/components/uv-code-input/uv-code-input.vue +272 -0
  47. package/components/uv-col/props.js +30 -0
  48. package/components/uv-col/uv-col.vue +165 -0
  49. package/components/uv-collapse/props.js +20 -0
  50. package/components/uv-collapse/uv-collapse.vue +86 -0
  51. package/components/uv-collapse-item/props.js +60 -0
  52. package/components/uv-collapse-item/uv-collapse-item.vue +228 -0
  53. package/components/uv-column-notice/props.js +61 -0
  54. package/components/uv-column-notice/uv-column-notice.vue +176 -0
  55. package/components/uv-count-down/props.js +25 -0
  56. package/components/uv-count-down/utils.js +62 -0
  57. package/components/uv-count-down/uv-count-down.vue +169 -0
  58. package/components/uv-count-to/props.js +60 -0
  59. package/components/uv-count-to/uv-count-to.vue +187 -0
  60. package/components/uv-datetime-picker/props.js +130 -0
  61. package/components/uv-datetime-picker/uv-datetime-picker.vue +355 -0
  62. package/components/uv-divider/props.js +45 -0
  63. package/components/uv-divider/uv-divider.vue +113 -0
  64. package/components/uv-drop-down/uv-drop-down.vue +135 -0
  65. package/components/uv-drop-down-item/uv-drop-down-item.vue +169 -0
  66. package/components/uv-drop-down-popup/uv-drop-down-popup.vue +242 -0
  67. package/components/uv-empty/props.js +60 -0
  68. package/components/uv-empty/uv-empty.vue +126 -0
  69. package/components/uv-form/props.js +46 -0
  70. package/components/uv-form/uv-form.vue +209 -0
  71. package/components/uv-form/valid.js +1343 -0
  72. package/components/uv-form-item/props.js +49 -0
  73. package/components/uv-form-item/uv-form-item.vue +226 -0
  74. package/components/uv-gap/props.js +25 -0
  75. package/components/uv-gap/uv-gap.vue +36 -0
  76. package/components/uv-grid/props.js +20 -0
  77. package/components/uv-grid/uv-grid.vue +100 -0
  78. package/components/uv-grid-item/props.js +15 -0
  79. package/components/uv-grid-item/uv-grid-item.vue +223 -0
  80. package/components/uv-icon/icons.js +160 -0
  81. package/components/uv-icon/props.js +90 -0
  82. package/components/uv-icon/uv-icon.vue +226 -0
  83. package/components/uv-icon/uvicons.ttf +0 -0
  84. package/components/uv-image/props.js +100 -0
  85. package/components/uv-image/uv-image.vue +296 -0
  86. package/components/uv-index-anchor/props.js +30 -0
  87. package/components/uv-index-anchor/uv-index-anchor.vue +98 -0
  88. package/components/uv-index-item/uv-index-item.vue +87 -0
  89. package/components/uv-index-list/props.js +30 -0
  90. package/components/uv-index-list/uv-index-list.vue +461 -0
  91. package/components/uv-input/props.js +175 -0
  92. package/components/uv-input/uv-input.vue +348 -0
  93. package/components/uv-keyboard/props.js +95 -0
  94. package/components/uv-keyboard/uv-keyboard.vue +180 -0
  95. package/components/uv-keyboard-car/props.js +24 -0
  96. package/components/uv-keyboard-car/uv-keyboard-car.vue +347 -0
  97. package/components/uv-keyboard-number/props.js +19 -0
  98. package/components/uv-keyboard-number/uv-keyboard-number.vue +201 -0
  99. package/components/uv-line/props.js +34 -0
  100. package/components/uv-line/uv-line.vue +60 -0
  101. package/components/uv-line-progress/props.js +29 -0
  102. package/components/uv-line-progress/uv-line-progress.vue +146 -0
  103. package/components/uv-link/props.js +40 -0
  104. package/components/uv-link/uv-link.vue +83 -0
  105. package/components/uv-list/uv-list.vue +147 -0
  106. package/components/uv-list-item/uv-list-item.vue +535 -0
  107. package/components/uv-load-more/props.js +95 -0
  108. package/components/uv-load-more/uv-load-more.vue +152 -0
  109. package/components/uv-loading-icon/props.js +67 -0
  110. package/components/uv-loading-icon/uv-loading-icon.vue +347 -0
  111. package/components/uv-loading-page/props.js +55 -0
  112. package/components/uv-loading-page/uv-loading-page.vue +96 -0
  113. package/components/uv-modal/props.js +90 -0
  114. package/components/uv-modal/uv-modal.vue +245 -0
  115. package/components/uv-navbar/props.js +89 -0
  116. package/components/uv-navbar/uv-navbar.vue +245 -0
  117. package/components/uv-no-network/props.js +20 -0
  118. package/components/uv-no-network/uv-no-network.vue +222 -0
  119. package/components/uv-notice-bar/props.js +76 -0
  120. package/components/uv-notice-bar/uv-notice-bar.vue +110 -0
  121. package/components/uv-notify/props.js +45 -0
  122. package/components/uv-notify/uv-notify.vue +220 -0
  123. package/components/uv-number-box/props.js +118 -0
  124. package/components/uv-number-box/uv-number-box.vue +397 -0
  125. package/components/uv-overlay/props.js +25 -0
  126. package/components/uv-overlay/uv-overlay.vue +85 -0
  127. package/components/uv-parse/node/node.vue +576 -0
  128. package/components/uv-parse/parser.js +1335 -0
  129. package/components/uv-parse/uv-parse.vue +498 -0
  130. package/components/uv-pick-color/colors.js +217 -0
  131. package/components/uv-pick-color/props.js +47 -0
  132. package/components/uv-pick-color/uv-pick-color.vue +551 -0
  133. package/components/uv-picker/props.js +95 -0
  134. package/components/uv-picker/uv-picker.vue +329 -0
  135. package/components/uv-popup/keypress.js +45 -0
  136. package/components/uv-popup/uv-popup.vue +537 -0
  137. package/components/uv-preview-video/uv-preview-video.vue +52 -0
  138. package/components/uv-qrcode/cache.js +1 -0
  139. package/components/uv-qrcode/gcanvas/bridge/bridge-weex.js +241 -0
  140. package/components/uv-qrcode/gcanvas/context-2d/FillStyleLinearGradient.js +18 -0
  141. package/components/uv-qrcode/gcanvas/context-2d/FillStylePattern.js +8 -0
  142. package/components/uv-qrcode/gcanvas/context-2d/FillStyleRadialGradient.js +17 -0
  143. package/components/uv-qrcode/gcanvas/context-2d/RenderingContext.js +666 -0
  144. package/components/uv-qrcode/gcanvas/context-webgl/ActiveInfo.js +11 -0
  145. package/components/uv-qrcode/gcanvas/context-webgl/Buffer.js +21 -0
  146. package/components/uv-qrcode/gcanvas/context-webgl/Framebuffer.js +21 -0
  147. package/components/uv-qrcode/gcanvas/context-webgl/GLenum.js +298 -0
  148. package/components/uv-qrcode/gcanvas/context-webgl/GLmethod.js +142 -0
  149. package/components/uv-qrcode/gcanvas/context-webgl/GLtype.js +23 -0
  150. package/components/uv-qrcode/gcanvas/context-webgl/Program.js +21 -0
  151. package/components/uv-qrcode/gcanvas/context-webgl/Renderbuffer.js +21 -0
  152. package/components/uv-qrcode/gcanvas/context-webgl/RenderingContext.js +1191 -0
  153. package/components/uv-qrcode/gcanvas/context-webgl/Shader.js +22 -0
  154. package/components/uv-qrcode/gcanvas/context-webgl/ShaderPrecisionFormat.js +11 -0
  155. package/components/uv-qrcode/gcanvas/context-webgl/Texture.js +22 -0
  156. package/components/uv-qrcode/gcanvas/context-webgl/UniformLocation.js +22 -0
  157. package/components/uv-qrcode/gcanvas/context-webgl/classUtils.js +3 -0
  158. package/components/uv-qrcode/gcanvas/env/canvas.js +74 -0
  159. package/components/uv-qrcode/gcanvas/env/image.js +96 -0
  160. package/components/uv-qrcode/gcanvas/env/tool.js +24 -0
  161. package/components/uv-qrcode/gcanvas/index.js +39 -0
  162. package/components/uv-qrcode/props.js +85 -0
  163. package/components/uv-qrcode/qrcode.js +34 -0
  164. package/components/uv-qrcode/queue.js +41 -0
  165. package/components/uv-qrcode/uv-qrcode.vue +1038 -0
  166. package/components/uv-radio/props.js +65 -0
  167. package/components/uv-radio/uv-radio.vue +349 -0
  168. package/components/uv-radio-group/props.js +89 -0
  169. package/components/uv-radio-group/uv-radio-group.vue +115 -0
  170. package/components/uv-rate/props.js +73 -0
  171. package/components/uv-rate/uv-rate.vue +274 -0
  172. package/components/uv-read-more/props.js +62 -0
  173. package/components/uv-read-more/uv-read-more.vue +162 -0
  174. package/components/uv-row/props.js +20 -0
  175. package/components/uv-row/uv-row.vue +95 -0
  176. package/components/uv-row-notice/props.js +40 -0
  177. package/components/uv-row-notice/uv-row-notice.vue +341 -0
  178. package/components/uv-safe-bottom/uv-safe-bottom.vue +67 -0
  179. package/components/uv-scroll-list/nvue.js +29 -0
  180. package/components/uv-scroll-list/props.js +35 -0
  181. package/components/uv-scroll-list/scrollWxs.wxs +51 -0
  182. package/components/uv-scroll-list/uv-scroll-list.vue +218 -0
  183. package/components/uv-search/props.js +127 -0
  184. package/components/uv-search/uv-search.vue +311 -0
  185. package/components/uv-skeleton/props.js +65 -0
  186. package/components/uv-skeleton/uv-skeleton.vue +250 -0
  187. package/components/uv-skeletons/uv-skeletons.vue +247 -0
  188. package/components/uv-slider/props.js +58 -0
  189. package/components/uv-slider/uv-slider.vue +58 -0
  190. package/components/uv-status-bar/props.js +8 -0
  191. package/components/uv-status-bar/uv-status-bar.vue +54 -0
  192. package/components/uv-steps/props.js +40 -0
  193. package/components/uv-steps/uv-steps.vue +83 -0
  194. package/components/uv-steps-item/props.js +25 -0
  195. package/components/uv-steps-item/uv-steps-item.vue +347 -0
  196. package/components/uv-sticky/props.js +41 -0
  197. package/components/uv-sticky/uv-sticky.vue +223 -0
  198. package/components/uv-subsection/props.js +54 -0
  199. package/components/uv-subsection/uv-subsection.vue +269 -0
  200. package/components/uv-swipe-action/props.js +10 -0
  201. package/components/uv-swipe-action/uv-swipe-action.vue +65 -0
  202. package/components/uv-swipe-action-item/index - backup.wxs +256 -0
  203. package/components/uv-swipe-action-item/index.wxs +225 -0
  204. package/components/uv-swipe-action-item/nvue - backup.js +264 -0
  205. package/components/uv-swipe-action-item/nvue.js +182 -0
  206. package/components/uv-swipe-action-item/props.js +40 -0
  207. package/components/uv-swipe-action-item/uv-swipe-action-item.vue +200 -0
  208. package/components/uv-swipe-action-item/wxs.js +15 -0
  209. package/components/uv-swiper/props.js +136 -0
  210. package/components/uv-swiper/uv-swiper.vue +263 -0
  211. package/components/uv-swiper-indicator/props.js +30 -0
  212. package/components/uv-swiper-indicator/uv-swiper-indicator.vue +112 -0
  213. package/components/uv-switch/props.js +58 -0
  214. package/components/uv-switch/uv-switch.vue +182 -0
  215. package/components/uv-tabbar/props.js +50 -0
  216. package/components/uv-tabbar/uv-tabbar.vue +146 -0
  217. package/components/uv-tabbar-item/props.js +40 -0
  218. package/components/uv-tabbar-item/uv-tabbar-item.vue +146 -0
  219. package/components/uv-tabs/props.js +71 -0
  220. package/components/uv-tabs/uv-tabs.vue +391 -0
  221. package/components/uv-tags/props.js +104 -0
  222. package/components/uv-tags/uv-tags.vue +379 -0
  223. package/components/uv-text/props.js +113 -0
  224. package/components/uv-text/uv-text.vue +218 -0
  225. package/components/uv-text/value.js +87 -0
  226. package/components/uv-textarea/props.js +138 -0
  227. package/components/uv-textarea/uv-textarea.vue +238 -0
  228. package/components/uv-toast/uv-toast.vue +292 -0
  229. package/components/uv-toolbar/props.js +40 -0
  230. package/components/uv-toolbar/uv-toolbar.vue +109 -0
  231. package/components/uv-tooltip/props.js +60 -0
  232. package/components/uv-tooltip/uv-tooltip.vue +372 -0
  233. package/components/uv-transition/createAnimation.js +131 -0
  234. package/components/uv-transition/props.js +31 -0
  235. package/components/uv-transition/uv-transition.vue +320 -0
  236. package/components/uv-upload/mixin.js +22 -0
  237. package/components/uv-upload/props.js +130 -0
  238. package/components/uv-upload/utils.js +151 -0
  239. package/components/uv-upload/uv-upload.vue +488 -0
  240. package/components/uv-vtabs/props.js +79 -0
  241. package/components/uv-vtabs/uv-vtabs.vue +438 -0
  242. package/components/uv-vtabs-item/uv-vtabs-item.vue +68 -0
  243. package/components/uv-waterfall/props.js +69 -0
  244. package/components/uv-waterfall/uv-waterfall.vue +265 -0
  245. package/index.js +82 -0
  246. package/index.scss +7 -0
  247. package/libs/config/config.js +34 -0
  248. package/libs/css/color.scss +32 -0
  249. package/libs/css/common.scss +100 -0
  250. package/libs/css/components.scss +23 -0
  251. package/libs/css/variable.scss +111 -0
  252. package/libs/css/vue.scss +40 -0
  253. package/libs/function/colorGradient.js +134 -0
  254. package/libs/function/compress.js +27 -0
  255. package/libs/function/debounce.js +29 -0
  256. package/libs/function/digit.js +167 -0
  257. package/libs/function/index.js +734 -0
  258. package/libs/function/platform.js +75 -0
  259. package/libs/function/test.js +287 -0
  260. package/libs/function/throttle.js +30 -0
  261. package/libs/luch-request/adapters/index.js +132 -0
  262. package/libs/luch-request/core/InterceptorManager.js +51 -0
  263. package/libs/luch-request/core/Request.js +201 -0
  264. package/libs/luch-request/core/buildFullPath.js +20 -0
  265. package/libs/luch-request/core/defaults.js +33 -0
  266. package/libs/luch-request/core/dispatchRequest.js +6 -0
  267. package/libs/luch-request/core/mergeConfig.js +126 -0
  268. package/libs/luch-request/core/settle.js +16 -0
  269. package/libs/luch-request/helpers/buildURL.js +64 -0
  270. package/libs/luch-request/helpers/combineURLs.js +14 -0
  271. package/libs/luch-request/helpers/isAbsoluteURL.js +14 -0
  272. package/libs/luch-request/index.d.ts +197 -0
  273. package/libs/luch-request/index.js +2 -0
  274. package/libs/luch-request/utils/clone.js +264 -0
  275. package/libs/luch-request/utils.js +135 -0
  276. package/libs/mixin/button.js +13 -0
  277. package/libs/mixin/mixin.js +172 -0
  278. package/libs/mixin/mpMixin.js +8 -0
  279. package/libs/mixin/mpShare.js +13 -0
  280. package/libs/mixin/openType.js +47 -0
  281. package/libs/mixin/touch.js +59 -0
  282. package/libs/util/dayjs.js +216 -0
  283. package/libs/util/route.js +126 -0
  284. package/package.json +28 -0
  285. package/theme.scss +43 -0
@@ -0,0 +1,152 @@
1
+ <template>
2
+ <view
3
+ class="uv-loadmore"
4
+ :style="[{
5
+ backgroundColor: bgColor,
6
+ marginBottom: $uv.addUnit(marginBottom),
7
+ marginTop: $uv.addUnit(marginTop),
8
+ height: $uv.addUnit(height),
9
+ },
10
+ $uv.addStyle(customStyle)]"
11
+ >
12
+ <uv-line
13
+ length="140rpx"
14
+ :color="lineColor"
15
+ :hairline="false"
16
+ :dashed="dashed"
17
+ v-if="line"
18
+ ></uv-line>
19
+ <!-- 加载中和没有更多的状态才显示两边的横线 -->
20
+ <view
21
+ :class="status == 'loadmore' || status == 'nomore' ? 'uv-more' : ''"
22
+ class="uv-loadmore__content"
23
+ >
24
+ <view
25
+ class="uv-loadmore__content__icon-wrap"
26
+ v-if="status === 'loading' && icon"
27
+ >
28
+ <uv-loading-icon
29
+ :color="iconColor"
30
+ :size="iconSize"
31
+ :mode="loadingIcon"
32
+ ></uv-loading-icon>
33
+ </view>
34
+ <!-- 如果没有更多的状态下,显示内容为dot(粗点),加载特定样式 -->
35
+ <text
36
+ class="uv-line-1"
37
+ :style="[loadTextStyle]"
38
+ :class="[(status == 'nomore' && isDot == true) ? 'uv-loadmore__content__dot-text' : 'uv-loadmore__content__text']"
39
+ @tap="loadMore"
40
+ >{{ showText }}</text>
41
+ </view>
42
+ <uv-line
43
+ length="140rpx"
44
+ :color="lineColor"
45
+ :hairline="false"
46
+ :dashed="dashed"
47
+ v-if="line"
48
+ ></uv-line>
49
+ </view>
50
+ </template>
51
+
52
+ <script>
53
+ import mpMixin from '../../libs/mixin/mpMixin.js'
54
+ import mixin from '../../libs/mixin/mixin.js'
55
+ import props from './props.js';
56
+
57
+ /**
58
+ * loadmore 加载更多
59
+ * @description 此组件一般用于标识页面底部加载数据时的状态。
60
+ * @tutorial https://www.uvui.cn/components/loadMore.html
61
+ * @property {String} status 组件状态(默认 'loadmore' )
62
+ * @property {String} bgColor 组件背景颜色,在页面是非白色时会用到(默认 'transparent' )
63
+ * @property {Boolean} icon 加载中时是否显示图标(默认 true )
64
+ * @property {String | Number} fontSize 字体大小(默认 14 )
65
+ * @property {String | Number} iconSize 图标大小(默认 17 )
66
+ * @property {String} color 字体颜色(默认 '#606266' )
67
+ * @property {String} loadingIcon 加载图标(默认 'circle' )
68
+ * @property {String} loadmoreText 加载前的提示语(默认 '加载更多' )
69
+ * @property {String} loadingText 加载中提示语(默认 '正在加载...' )
70
+ * @property {String} nomoreText 没有更多的提示语(默认 '没有更多了' )
71
+ * @property {Boolean} isDot 到上一个相邻元素的距离 (默认 false )
72
+ * @property {String} iconColor 加载中图标的颜色 (默认 '#b7b7b7' )
73
+ * @property {String} lineColor 线条颜色(默认 #E6E8EB )
74
+ * @property {String | Number} marginTop 上边距 (默认 10 )
75
+ * @property {String | Number} marginBottom 下边距 (默认 10 )
76
+ * @property {String | Number} height 高度,单位px (默认 'auto' )
77
+ * @property {Boolean} line 是否显示左边分割线 (默认 false )
78
+ * @property {Boolean} dashed // 是否虚线,true-虚线,false-实线 (默认 false )
79
+ * @event {Function} loadmore status为loadmore时,点击组件会发出此事件
80
+ * @example <uv-loadmore :status="status" icon-type="iconType" load-text="loadText" />
81
+ */
82
+ export default {
83
+ name: "uv-loadmore",
84
+ mixins: [mpMixin, mixin,props],
85
+ data() {
86
+ return {
87
+ // 粗点
88
+ dotText: "●"
89
+ }
90
+ },
91
+ computed: {
92
+ // 加载的文字显示的样式
93
+ loadTextStyle() {
94
+ return {
95
+ color: this.color,
96
+ fontSize: this.$uv.addUnit(this.fontSize),
97
+ lineHeight: this.$uv.addUnit(this.fontSize),
98
+ backgroundColor: this.bgColor,
99
+ }
100
+ },
101
+ // 显示的提示文字
102
+ showText() {
103
+ let text = '';
104
+ if (this.status == 'loadmore') text = this.loadmoreText
105
+ else if (this.status == 'loading') text = this.loadingText
106
+ else if (this.status == 'nomore' && this.isDot) text = this.dotText;
107
+ else text = this.nomoreText;
108
+ return text;
109
+ }
110
+ },
111
+ methods: {
112
+ loadMore() {
113
+ // 只有在“加载更多”的状态下才发送点击事件,内容不满一屏时无法触发底部上拉事件,所以需要点击来触发
114
+ if (this.status == 'loadmore') this.$emit('loadmore');
115
+ }
116
+ }
117
+ }
118
+ </script>
119
+
120
+ <style lang="scss" scoped>
121
+ $show-lines: 1;
122
+ @import '../../libs/css/variable.scss';
123
+ @import '../../libs/css/components.scss';
124
+ @import '../../libs/css/color.scss';
125
+ .uv-loadmore {
126
+ @include flex(row);
127
+ align-items: center;
128
+ justify-content: center;
129
+ flex: 1;
130
+
131
+ &__content {
132
+ margin: 0 15px;
133
+ @include flex(row);
134
+ align-items: center;
135
+ justify-content: center;
136
+
137
+ &__icon-wrap {
138
+ margin-right: 8px;
139
+ }
140
+
141
+ &__text {
142
+ font-size: 14px;
143
+ color: $uv-content-color;
144
+ }
145
+
146
+ &__dot-text {
147
+ font-size: 15px;
148
+ color: $uv-tips-color;
149
+ }
150
+ }
151
+ }
152
+ </style>
@@ -0,0 +1,67 @@
1
+ export default {
2
+ props: {
3
+ // 是否显示组件
4
+ show: {
5
+ type: Boolean,
6
+ default: true
7
+ },
8
+ // 颜色
9
+ color: {
10
+ type: String,
11
+ default: '#909193'
12
+ },
13
+ // 提示文字颜色
14
+ textColor: {
15
+ type: String,
16
+ default: '#909193'
17
+ },
18
+ // 文字和图标是否垂直排列
19
+ vertical: {
20
+ type: Boolean,
21
+ default: false
22
+ },
23
+ // 模式选择,circle-圆形,spinner-花朵形,semicircle-半圆形
24
+ mode: {
25
+ type: String,
26
+ default: 'spinner'
27
+ },
28
+ // 图标大小,单位默认px
29
+ size: {
30
+ type: [String, Number],
31
+ default: 24
32
+ },
33
+ // 文字大小
34
+ textSize: {
35
+ type: [String, Number],
36
+ default: 15
37
+ },
38
+ // 文字样式
39
+ textStyle: {
40
+ type: Object,
41
+ default () {
42
+ return {}
43
+ }
44
+ },
45
+ // 文字内容
46
+ text: {
47
+ type: [String, Number],
48
+ default: ''
49
+ },
50
+ // 动画模式 https://www.runoob.com/cssref/css3-pr-animation-timing-function.html
51
+ timingFunction: {
52
+ type: String,
53
+ default: 'linear'
54
+ },
55
+ // 动画执行周期时间
56
+ duration: {
57
+ type: [String, Number],
58
+ default: 1200
59
+ },
60
+ // mode=circle时的暗边颜色
61
+ inactiveColor: {
62
+ type: String,
63
+ default: ''
64
+ },
65
+ ...uni.$uv?.props?.loadingIcon
66
+ }
67
+ }
@@ -0,0 +1,347 @@
1
+ <template>
2
+ <view
3
+ class="uv-loading-icon"
4
+ :style="[$uv.addStyle(customStyle)]"
5
+ :class="[vertical && 'uv-loading-icon--vertical']"
6
+ v-if="show"
7
+ >
8
+ <view
9
+ v-if="!webviewHide"
10
+ class="uv-loading-icon__spinner"
11
+ :class="[`uv-loading-icon__spinner--${mode}`]"
12
+ ref="ani"
13
+ :style="{
14
+ color: color,
15
+ width: $uv.addUnit(size),
16
+ height: $uv.addUnit(size),
17
+ borderTopColor: color,
18
+ borderBottomColor: otherBorderColor,
19
+ borderLeftColor: otherBorderColor,
20
+ borderRightColor: otherBorderColor,
21
+ 'animation-duration': `${duration}ms`,
22
+ 'animation-timing-function': mode === 'semicircle' || mode === 'circle' ? timingFunction : ''
23
+ }"
24
+ >
25
+ <block v-if="mode === 'spinner'">
26
+ <!-- #ifndef APP-NVUE -->
27
+ <view
28
+ v-for="(item, index) in array12"
29
+ :key="index"
30
+ class="uv-loading-icon__dot"
31
+ >
32
+ </view>
33
+ <!-- #endif -->
34
+ <!-- #ifdef APP-NVUE -->
35
+ <!-- 此组件内部图标部分无法设置宽高,即使通过width和height配置了也无效 -->
36
+ <loading-indicator
37
+ v-if="!webviewHide"
38
+ class="uv-loading-indicator"
39
+ :animating="true"
40
+ :style="{
41
+ color: color,
42
+ width: $uv.addUnit(size),
43
+ height: $uv.addUnit(size)
44
+ }"
45
+ />
46
+ <!-- #endif -->
47
+ </block>
48
+ </view>
49
+ <text
50
+ v-if="text"
51
+ class="uv-loading-icon__text"
52
+ :style="[{
53
+ fontSize: $uv.addUnit(textSize),
54
+ color: textColor,
55
+ },$uv.addStyle(textStyle)]"
56
+ >{{text}}</text>
57
+ </view>
58
+ </template>
59
+
60
+ <script>
61
+ import { colorGradient } from '../../libs/function/colorGradient.js'
62
+ import mpMixin from '../../libs/mixin/mpMixin.js'
63
+ import mixin from '../../libs/mixin/mixin.js'
64
+ import props from './props.js';
65
+ // #ifdef APP-NVUE
66
+ const animation = weex.requireModule('animation');
67
+ // #endif
68
+ /**
69
+ * loading 加载动画
70
+ * @description 警此组件为一个小动画,目前用在uvui的loadmore加载更多和switch开关等组件的正在加载状态场景。
71
+ * @tutorial https://www.uvui.cn/components/loading.html
72
+ * @property {Boolean} show 是否显示组件 (默认 true)
73
+ * @property {String} color 动画活动区域的颜色,只对 mode = flower 模式有效(默认#909193)
74
+ * @property {String} textColor 提示文本的颜色(默认#909193)
75
+ * @property {Boolean} vertical 文字和图标是否垂直排列 (默认 false )
76
+ * @property {String} mode 模式选择,见官网说明(默认 'circle' )
77
+ * @property {String | Number} size 加载图标的大小,单位px (默认 24 )
78
+ * @property {String | Number} textSize 文字大小(默认 15 )
79
+ * @property {String | Number} text 文字内容
80
+ * @property {Object} textStyle 文字样式
81
+ * @property {String} timingFunction 动画模式 (默认 'ease-in-out' )
82
+ * @property {String | Number} duration 动画执行周期时间(默认 1200)
83
+ * @property {String} inactiveColor mode=circle时的暗边颜色
84
+ * @property {Object} customStyle 定义需要用到的外部样式
85
+ * @example <uv-loading mode="circle"></uv-loading>
86
+ */
87
+ export default {
88
+ name: 'uv-loading-icon',
89
+ mixins: [mpMixin, mixin, props],
90
+ data() {
91
+ return {
92
+ // Array.form可以通过一个伪数组对象创建指定长度的数组
93
+ // https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/from
94
+ array12: Array.from({
95
+ length: 12
96
+ }),
97
+ // 这里需要设置默认值为360,否则在安卓nvue上,会延迟一个duration周期后才执行
98
+ // 在iOS nvue上,则会一开始默认执行两个周期的动画
99
+ aniAngel: 360, // 动画旋转角度
100
+ webviewHide: false, // 监听webview的状态,如果隐藏了页面,则停止动画,以免性能消耗
101
+ loading: false, // 是否运行中,针对nvue使用
102
+ }
103
+ },
104
+ computed: {
105
+ // 当为circle类型时,给其另外三边设置一个更轻一些的颜色
106
+ // 之所以需要这么做的原因是,比如父组件传了color为红色,那么需要另外的三个边为浅红色
107
+ // 而不能是固定的某一个其他颜色(因为这个固定的颜色可能浅蓝,导致效果没有那么细腻良好)
108
+ otherBorderColor() {
109
+ const lightColor = colorGradient(this.color, '#ffffff', 100)[80]
110
+ if (this.mode === 'circle') {
111
+ return this.inactiveColor ? this.inactiveColor : lightColor
112
+ } else {
113
+ return 'transparent'
114
+ }
115
+ }
116
+ },
117
+ watch: {
118
+ show(n) {
119
+ // nvue中,show为true,且为非loading状态,就重新执行动画模块
120
+ // #ifdef APP-NVUE
121
+ if (n && !this.loading) {
122
+ setTimeout(() => {
123
+ this.startAnimate()
124
+ }, 30)
125
+ }
126
+ // #endif
127
+ }
128
+ },
129
+ mounted() {
130
+ this.init()
131
+ },
132
+ methods: {
133
+ init() {
134
+ setTimeout(() => {
135
+ // #ifdef APP-NVUE
136
+ this.show && this.nvueAnimate()
137
+ // #endif
138
+ // #ifdef APP-PLUS
139
+ this.show && this.addEventListenerToWebview()
140
+ // #endif
141
+ }, 20)
142
+ },
143
+ // 监听webview的显示与隐藏
144
+ addEventListenerToWebview() {
145
+ // webview的堆栈
146
+ const pages = getCurrentPages()
147
+ // 当前页面
148
+ const page = pages[pages.length - 1]
149
+ // 当前页面的webview实例
150
+ const currentWebview = page.$getAppWebview()
151
+ // 监听webview的显示与隐藏,从而停止或者开始动画(为了性能)
152
+ currentWebview.addEventListener('hide', () => {
153
+ this.webviewHide = true
154
+ })
155
+ currentWebview.addEventListener('show', () => {
156
+ this.webviewHide = false
157
+ })
158
+ },
159
+ // #ifdef APP-NVUE
160
+ nvueAnimate() {
161
+ // nvue下,非spinner类型时才需要旋转,因为nvue的spinner类型,使用了weex的
162
+ // loading-indicator组件,自带旋转功能
163
+ this.mode !== 'spinner' && this.startAnimate()
164
+ },
165
+ // 执行nvue的animate模块动画
166
+ startAnimate() {
167
+ this.loading = true
168
+ const ani = this.$refs.ani
169
+ if (!ani) return
170
+ animation.transition(ani, {
171
+ // 进行角度旋转
172
+ styles: {
173
+ transform: `rotate(${this.aniAngel}deg)`,
174
+ transformOrigin: 'center center'
175
+ },
176
+ duration: this.duration,
177
+ timingFunction: this.timingFunction,
178
+ // delay: 10
179
+ }, () => {
180
+ // 每次增加360deg,为了让其重新旋转一周
181
+ this.aniAngel += 360
182
+ // 动画结束后,继续循环执行动画,需要同时判断webviewHide变量
183
+ // nvue安卓,页面隐藏后依然会继续执行startAnimate方法
184
+ this.show && !this.webviewHide ? this.startAnimate() : this.loading = false
185
+ })
186
+ }
187
+ // #endif
188
+ }
189
+ }
190
+ </script>
191
+
192
+ <style lang="scss" scoped>
193
+ @import '../../libs/css/components.scss';
194
+ @import '../../libs/css/color.scss';
195
+ $uv-loading-icon-color: #c8c9cc !default;
196
+ $uv-loading-icon-text-margin-left:4px !default;
197
+ $uv-loading-icon-text-color:$uv-content-color !default;
198
+ $uv-loading-icon-text-font-size:14px !default;
199
+ $uv-loading-icon-text-line-height:20px !default;
200
+ $uv-loading-width:30px !default;
201
+ $uv-loading-height:30px !default;
202
+ $uv-loading-max-width:100% !default;
203
+ $uv-loading-max-height:100% !default;
204
+ $uv-loading-semicircle-border-width: 2px !default;
205
+ $uv-loading-semicircle-border-color:transparent !default;
206
+ $uv-loading-semicircle-border-top-right-radius: 100px !default;
207
+ $uv-loading-semicircle-border-top-left-radius: 100px !default;
208
+ $uv-loading-semicircle-border-bottom-left-radius: 100px !default;
209
+ $uv-loading-semicircle-border-bottom-right-radiu: 100px !default;
210
+ $uv-loading-semicircle-border-style: solid !default;
211
+ $uv-loading-circle-border-top-right-radius: 100px !default;
212
+ $uv-loading-circle-border-top-left-radius: 100px !default;
213
+ $uv-loading-circle-border-bottom-left-radius: 100px !default;
214
+ $uv-loading-circle-border-bottom-right-radiu: 100px !default;
215
+ $uv-loading-circle-border-width:2px !default;
216
+ $uv-loading-circle-border-top-color:#e5e5e5 !default;
217
+ $uv-loading-circle-border-right-color:$uv-loading-circle-border-top-color !default;
218
+ $uv-loading-circle-border-bottom-color:$uv-loading-circle-border-top-color !default;
219
+ $uv-loading-circle-border-left-color:$uv-loading-circle-border-top-color !default;
220
+ $uv-loading-circle-border-style:solid !default;
221
+ $uv-loading-icon-host-font-size:0px !default;
222
+ $uv-loading-icon-host-line-height:1 !default;
223
+ $uv-loading-icon-vertical-margin:6px 0 0 !default;
224
+ $uv-loading-icon-dot-top:0 !default;
225
+ $uv-loading-icon-dot-left:0 !default;
226
+ $uv-loading-icon-dot-width:100% !default;
227
+ $uv-loading-icon-dot-height:100% !default;
228
+ $uv-loading-icon-dot-before-width:2px !default;
229
+ $uv-loading-icon-dot-before-height:25% !default;
230
+ $uv-loading-icon-dot-before-margin:0 auto !default;
231
+ $uv-loading-icon-dot-before-background-color:currentColor !default;
232
+ $uv-loading-icon-dot-before-border-radius:40% !default;
233
+
234
+ .uv-loading-icon {
235
+ /* #ifndef APP-NVUE */
236
+ // display: inline-flex;
237
+ /* #endif */
238
+ flex-direction: row;
239
+ align-items: center;
240
+ justify-content: center;
241
+ color: $uv-loading-icon-color;
242
+
243
+ &__text {
244
+ margin-left: $uv-loading-icon-text-margin-left;
245
+ color: $uv-loading-icon-text-color;
246
+ font-size: $uv-loading-icon-text-font-size;
247
+ line-height: $uv-loading-icon-text-line-height;
248
+ }
249
+
250
+ &__spinner {
251
+ width: $uv-loading-width;
252
+ height: $uv-loading-height;
253
+ position: relative;
254
+ /* #ifndef APP-NVUE */
255
+ box-sizing: border-box;
256
+ max-width: $uv-loading-max-width;
257
+ max-height: $uv-loading-max-height;
258
+ animation: uv-rotate 1s linear infinite;
259
+ /* #endif */
260
+ }
261
+
262
+ &__spinner--semicircle {
263
+ border-width: $uv-loading-semicircle-border-width;
264
+ border-color: $uv-loading-semicircle-border-color;
265
+ border-top-right-radius: $uv-loading-semicircle-border-top-right-radius;
266
+ border-top-left-radius: $uv-loading-semicircle-border-top-left-radius;
267
+ border-bottom-left-radius: $uv-loading-semicircle-border-bottom-left-radius;
268
+ border-bottom-right-radius: $uv-loading-semicircle-border-bottom-right-radiu;
269
+ border-style: $uv-loading-semicircle-border-style;
270
+ }
271
+
272
+ &__spinner--circle {
273
+ border-top-right-radius: $uv-loading-circle-border-top-right-radius;
274
+ border-top-left-radius: $uv-loading-circle-border-top-left-radius;
275
+ border-bottom-left-radius: $uv-loading-circle-border-bottom-left-radius;
276
+ border-bottom-right-radius: $uv-loading-circle-border-bottom-right-radiu;
277
+ border-width: $uv-loading-circle-border-width;
278
+ border-top-color: $uv-loading-circle-border-top-color;
279
+ border-right-color: $uv-loading-circle-border-right-color;
280
+ border-bottom-color: $uv-loading-circle-border-bottom-color;
281
+ border-left-color: $uv-loading-circle-border-left-color;
282
+ border-style: $uv-loading-circle-border-style;
283
+ }
284
+
285
+ &--vertical {
286
+ flex-direction: column
287
+ }
288
+ }
289
+
290
+ /* #ifndef APP-NVUE */
291
+ :host {
292
+ font-size: $uv-loading-icon-host-font-size;
293
+ line-height: $uv-loading-icon-host-line-height;
294
+ }
295
+
296
+ .uv-loading-icon {
297
+ &__spinner--spinner {
298
+ animation-timing-function: steps(12)
299
+ }
300
+
301
+ &__text:empty {
302
+ display: none
303
+ }
304
+
305
+ &--vertical &__text {
306
+ margin: $uv-loading-icon-vertical-margin;
307
+ color: $uv-content-color;
308
+ }
309
+
310
+ &__dot {
311
+ position: absolute;
312
+ top: $uv-loading-icon-dot-top;
313
+ left: $uv-loading-icon-dot-left;
314
+ width: $uv-loading-icon-dot-width;
315
+ height: $uv-loading-icon-dot-height;
316
+
317
+ &:before {
318
+ display: block;
319
+ width: $uv-loading-icon-dot-before-width;
320
+ height: $uv-loading-icon-dot-before-height;
321
+ margin: $uv-loading-icon-dot-before-margin;
322
+ background-color: $uv-loading-icon-dot-before-background-color;
323
+ border-radius: $uv-loading-icon-dot-before-border-radius;
324
+ content: " "
325
+ }
326
+ }
327
+ }
328
+
329
+ @for $i from 1 through 12 {
330
+ .uv-loading-icon__dot:nth-of-type(#{$i}) {
331
+ transform: rotate($i * 30deg);
332
+ opacity: 1 - 0.0625 * ($i - 1);
333
+ }
334
+ }
335
+
336
+ @keyframes uv-rotate {
337
+ 0% {
338
+ transform: rotate(0deg)
339
+ }
340
+
341
+ to {
342
+ transform: rotate(1turn)
343
+ }
344
+ }
345
+
346
+ /* #endif */
347
+ </style>
@@ -0,0 +1,55 @@
1
+ export default {
2
+ props: {
3
+ // 提示内容
4
+ loadingText: {
5
+ type: [String, Number],
6
+ default: ''
7
+ },
8
+ // 文字上方用于替换loading动画的图片
9
+ image: {
10
+ type: String,
11
+ default: ''
12
+ },
13
+ // 加载动画的模式,circle-圆形,spinner-花朵形,semicircle-半圆形
14
+ loadingMode: {
15
+ type: String,
16
+ default: 'circle'
17
+ },
18
+ // 是否加载中
19
+ loading: {
20
+ type: Boolean,
21
+ default: false
22
+ },
23
+ // 背景色
24
+ bgColor: {
25
+ type: String,
26
+ default: '#fff'
27
+ },
28
+ // 文字颜色
29
+ color: {
30
+ type: String,
31
+ default: '#C8C8C8'
32
+ },
33
+ // 文字大小
34
+ fontSize: {
35
+ type: [String, Number],
36
+ default: 18
37
+ },
38
+ // 图标大小
39
+ iconSize: {
40
+ type: [String, Number],
41
+ default: 28
42
+ },
43
+ // 加载中图标的颜色,只能rgb或者十六进制颜色值
44
+ loadingColor: {
45
+ type: String,
46
+ default: '#C8C8C8'
47
+ },
48
+ // 过渡时间
49
+ duration: {
50
+ type: [String, Number],
51
+ default: 300
52
+ },
53
+ ...uni.$uv?.props?.loadingPage
54
+ }
55
+ }