@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,15 @@
1
+ export default {
2
+ methods: {
3
+ // 关闭时执行
4
+ closeHandler() {
5
+ this.status = 'close'
6
+ },
7
+ setState(status) {
8
+ this.status = status
9
+ },
10
+ closeOther() {
11
+ // 尝试关闭其他打开的单元格
12
+ this.parent && this.parent.closeOther(this)
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,136 @@
1
+ export default {
2
+ props: {
3
+ // 列表数组,元素可为字符串,如为对象可通过keyName指定目标属性名
4
+ list: {
5
+ type: Array,
6
+ default: () => []
7
+ },
8
+ // 是否显示面板指示器
9
+ indicator: {
10
+ type: Boolean,
11
+ default: false
12
+ },
13
+ // 指示器非激活颜色
14
+ indicatorActiveColor: {
15
+ type: String,
16
+ default: '#fff'
17
+ },
18
+ // 指示器的激活颜色
19
+ indicatorInactiveColor: {
20
+ type: String,
21
+ default: 'rgba(255, 255, 255, 0.35)'
22
+ },
23
+ // 指示器样式,可通过bottom,left,right进行定位
24
+ indicatorStyle: {
25
+ type: [String, Object],
26
+ default: ''
27
+ },
28
+ // 指示器模式,line-线型,dot-点型
29
+ indicatorMode: {
30
+ type: String,
31
+ default: 'line'
32
+ },
33
+ // 是否自动切换
34
+ autoplay: {
35
+ type: Boolean,
36
+ default: true
37
+ },
38
+ // 当前所在滑块的 index
39
+ current: {
40
+ type: [String, Number],
41
+ default: 0
42
+ },
43
+ // 当前所在滑块的 item-id ,不能与 current 被同时指定
44
+ currentItemId: {
45
+ type: String,
46
+ default: ''
47
+ },
48
+ // 滑块自动切换时间间隔
49
+ interval: {
50
+ type: [String, Number],
51
+ default: 3000
52
+ },
53
+ // 滑块切换过程所需时间
54
+ duration: {
55
+ type: [String, Number],
56
+ default: 300
57
+ },
58
+ // 播放到末尾后是否重新回到开头
59
+ circular: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ // 滑动方向是否为纵向
64
+ vertical: {
65
+ type: Boolean,
66
+ default: false
67
+ },
68
+ // 前边距,可用于露出前一项的一小部分,nvue和支付宝不支持
69
+ previousMargin: {
70
+ type: [String, Number],
71
+ default: 0
72
+ },
73
+ // 后边距,可用于露出后一项的一小部分,nvue和支付宝不支持
74
+ nextMargin: {
75
+ type: [String, Number],
76
+ default: 0
77
+ },
78
+ // 当开启时,会根据滑动速度,连续滑动多屏,支付宝不支持
79
+ acceleration: {
80
+ type: Boolean,
81
+ default: false
82
+ },
83
+ // 同时显示的滑块数量,nvue、支付宝小程序不支持
84
+ displayMultipleItems: {
85
+ type: Number,
86
+ default: 1
87
+ },
88
+ // 指定swiper切换缓动动画类型,有效值:default、linear、easeInCubic、easeOutCubic、easeInOutCubic
89
+ // 只对微信小程序有效
90
+ easingFunction: {
91
+ type: String,
92
+ default: 'default'
93
+ },
94
+ // list数组中指定对象的目标属性名
95
+ keyName: {
96
+ type: String,
97
+ default: 'url'
98
+ },
99
+ // 图片的裁剪模式
100
+ imgMode: {
101
+ type: String,
102
+ default: 'aspectFill'
103
+ },
104
+ // 组件高度
105
+ height: {
106
+ type: [String, Number],
107
+ default: 130
108
+ },
109
+ // 背景颜色
110
+ bgColor: {
111
+ type: String,
112
+ default: '#f3f4f6'
113
+ },
114
+ // 组件圆角,数值或带单位的字符串
115
+ radius: {
116
+ type: [String, Number],
117
+ default: 4
118
+ },
119
+ // 是否加载中
120
+ loading: {
121
+ type: Boolean,
122
+ default: false
123
+ },
124
+ // 是否显示标题,要求数组对象中有title属性
125
+ showTitle: {
126
+ type: Boolean,
127
+ default: false
128
+ },
129
+ // 显示的标题样式
130
+ titleStyle: {
131
+ type: [Object, String],
132
+ default: ''
133
+ },
134
+ ...uni.$uv?.props?.swiper
135
+ }
136
+ }
@@ -0,0 +1,263 @@
1
+ <template>
2
+ <view
3
+ class="uv-swiper"
4
+ :style="{
5
+ backgroundColor: bgColor,
6
+ height: $uv.addUnit(height),
7
+ borderRadius: $uv.addUnit(radius)
8
+ }"
9
+ >
10
+ <view
11
+ class="uv-swiper__loading"
12
+ v-if="loading"
13
+ >
14
+ <uv-loading-icon mode="circle"></uv-loading-icon>
15
+ </view>
16
+ <swiper
17
+ v-else
18
+ class="uv-swiper__wrapper"
19
+ :style="{
20
+ height: $uv.addUnit(height),
21
+ flex: 1
22
+ }"
23
+ @change="change"
24
+ :circular="circular"
25
+ :vertical="vertical"
26
+ :interval="interval"
27
+ :duration="duration"
28
+ :autoplay="autoplay"
29
+ :current="current"
30
+ :currentItemId="currentItemId"
31
+ :previousMargin="$uv.addUnit(previousMargin)"
32
+ :nextMargin="$uv.addUnit(nextMargin)"
33
+ :acceleration="acceleration"
34
+ :displayMultipleItems="displayMultipleItems"
35
+ :easingFunction="easingFunction"
36
+ >
37
+ <swiper-item
38
+ class="uv-swiper__wrapper__item"
39
+ v-for="(item, index) in list"
40
+ :key="index"
41
+ >
42
+ <view
43
+ class="uv-swiper__wrapper__item__wrapper"
44
+ :style="[itemStyle(index)]"
45
+ >
46
+ <!-- 在nvue中,image图片的宽度默认为屏幕宽度,需要通过flex:1撑开,另外必须设置高度才能显示图片 -->
47
+ <image
48
+ class="uv-swiper__wrapper__item__wrapper__image"
49
+ v-if="getItemType(item) === 'image'"
50
+ :src="getSource(item)"
51
+ :mode="imgMode"
52
+ @tap="clickHandler(index)"
53
+ :style="{
54
+ height: $uv.addUnit(height),
55
+ borderRadius: $uv.addUnit(radius)
56
+ }"
57
+ ></image>
58
+ <video
59
+ class="uv-swiper__wrapper__item__wrapper__video"
60
+ v-if="getItemType(item) === 'video'"
61
+ :id="`video-${index}`"
62
+ :enable-progress-gesture="false"
63
+ :src="getSource(item)"
64
+ :poster="getPoster(item)"
65
+ :title="showTitle && $uv.test.object(item) && item.title ? item.title : ''"
66
+ :style="{
67
+ height: $uv.addUnit(height)
68
+ }"
69
+ controls
70
+ @tap="clickHandler(index)"
71
+ ></video>
72
+ <text
73
+ v-if="showTitle && $uv.test.object(item) && item.title"
74
+ class="uv-swiper__wrapper__item__wrapper__title uv-line-1"
75
+ :style="[$uv.addStyle(titleStyle)]"
76
+ >{{ item.title }}</text>
77
+ </view>
78
+ </swiper-item>
79
+ </swiper>
80
+ <view class="uv-swiper__indicator" :style="[$uv.addStyle(indicatorStyle)]">
81
+ <slot name="indicator">
82
+ <uv-swiper-indicator
83
+ v-if="!loading && indicator && !showTitle"
84
+ :indicatorActiveColor="indicatorActiveColor"
85
+ :indicatorInactiveColor="indicatorInactiveColor"
86
+ :length="list.length"
87
+ :current="currentIndex"
88
+ :indicatorMode="indicatorMode"
89
+ ></uv-swiper-indicator>
90
+ </slot>
91
+ </view>
92
+ </view>
93
+ </template>
94
+
95
+ <script>
96
+ import mpMixin from '../../libs/mixin/mpMixin.js'
97
+ import mixin from '../../libs/mixin/mixin.js'
98
+ import props from './props.js';
99
+ /**
100
+ * Swiper 轮播图
101
+ * @description 该组件一般用于导航轮播,广告展示等场景,可开箱即用,
102
+ * @tutorial https://www.uvui.cn/components/swiper.html
103
+ * @property {Array} list 轮播图数据
104
+ * @property {Boolean} indicator 是否显示面板指示器(默认 false )
105
+ * @property {String} indicatorActiveColor 指示器非激活颜色(默认 '#FFFFFF' )
106
+ * @property {String} indicatorInactiveColor 指示器的激活颜色(默认 'rgba(255, 255, 255, 0.35)' )
107
+ * @property {String | Object} indicatorStyle 指示器样式,可通过bottom,left,right进行定位
108
+ * @property {String} indicatorMode 指示器模式(默认 'line' )
109
+ * @property {Boolean} autoplay 是否自动切换(默认 true )
110
+ * @property {String | Number} current 当前所在滑块的 index(默认 0 )
111
+ * @property {String} currentItemId 当前所在滑块的 item-id ,不能与 current 被同时指定
112
+ * @property {String | Number} interval 滑块自动切换时间间隔(ms)(默认 3000 )
113
+ * @property {String | Number} duration 滑块切换过程所需时间(ms)(默认 300 )
114
+ * @property {Boolean} circular 播放到末尾后是否重新回到开头(默认 false )
115
+ * @property {String | Number} previousMargin 前边距,可用于露出前一项的一小部分,nvue和支付宝不支持(默认 0 )
116
+ * @property {String | Number} nextMargin 后边距,可用于露出后一项的一小部分,nvue和支付宝不支持(默认 0 )
117
+ * @property {Boolean} acceleration 当开启时,会根据滑动速度,连续滑动多屏,支付宝不支持(默认 false )
118
+ * @property {Number} displayMultipleItems 同时显示的滑块数量,nvue、支付宝小程序不支持(默认 1 )
119
+ * @property {String} easingFunction 指定swiper切换缓动动画类型, 只对微信小程序有效(默认 'default' )
120
+ * @property {String} keyName list数组中指定对象的目标属性名(默认 'url' )
121
+ * @property {String} imgMode 图片的裁剪模式(默认 'aspectFill' )
122
+ * @property {String | Number} height 组件高度(默认 130 )
123
+ * @property {String} bgColor 背景颜色(默认 '#f3f4f6' )
124
+ * @property {String | Number} radius 组件圆角,数值或带单位的字符串(默认 4 )
125
+ * @property {Boolean} loading 是否加载中(默认 false )
126
+ * @property {Boolean} showTitle 是否显示标题,要求数组对象中有title属性(默认 false )
127
+ * @event {Function(index)} click 点击轮播图时触发 index:点击了第几张图片,从0开始
128
+ * @event {Function(index)} change 轮播图切换时触发(自动或者手动切换) index:切换到了第几张图片,从0开始
129
+ * @example <uv-swiper :list="list4" keyName="url" :autoplay="false"></uv-swiper>
130
+ */
131
+ export default {
132
+ name: 'uv-swiper',
133
+ mixins: [mpMixin, mixin, props],
134
+ emits: ['click','change'],
135
+ data() {
136
+ return {
137
+ currentIndex: 0
138
+ }
139
+ },
140
+ watch: {
141
+ current(val, preVal) {
142
+ if(val === preVal) return;
143
+ this.currentIndex = val; // 和上游数据关联上
144
+ }
145
+ },
146
+ computed: {
147
+ itemStyle() {
148
+ return index => {
149
+ const style = {}
150
+ // #ifndef APP-NVUE || MP-TOUTIAO
151
+ // 左右流出空间的写法不支持nvue和头条
152
+ // 只有配置了此二值,才加上对应的圆角,以及缩放
153
+ if (this.nextMargin && this.previousMargin) {
154
+ style.borderRadius = this.$uv.addUnit(this.radius)
155
+ if (index !== this.currentIndex) style.transform = 'scale(0.92)'
156
+ }
157
+ // #endif
158
+ return style
159
+ }
160
+ }
161
+ },
162
+ methods: {
163
+ getItemType(item) {
164
+ if (typeof item === 'string') return this.$uv.test.video(this.getSource(item)) ? 'video' : 'image'
165
+ if (typeof item === 'object' && this.keyName) {
166
+ if (!item.type) return this.$uv.test.video(this.getSource(item)) ? 'video' : 'image'
167
+ if (item.type === 'image') return 'image'
168
+ if (item.type === 'video') return 'video'
169
+ return 'image'
170
+ }
171
+ },
172
+ // 获取目标路径,可能数组中为字符串,对象的形式,额外可指定对象的目标属性名keyName
173
+ getSource(item) {
174
+ if (typeof item === 'string') return item
175
+ if (typeof item === 'object' && this.keyName) return item[this.keyName]
176
+ else this.$uv.error('请按格式传递列表参数')
177
+ return ''
178
+ },
179
+ // 轮播切换事件
180
+ change(e) {
181
+ // 当前的激活索引
182
+ const {
183
+ current
184
+ } = e.detail
185
+ this.pauseVideo(this.currentIndex)
186
+ this.currentIndex = current
187
+ this.$emit('change', e.detail)
188
+ },
189
+ // 切换轮播时,暂停视频播放
190
+ pauseVideo(index) {
191
+ const lastItem = this.getSource(this.list[index])
192
+ if (this.$uv.test.video(lastItem)) {
193
+ // 当视频隐藏时,暂停播放
194
+ const video = uni.createVideoContext(`video-${index}`, this)
195
+ video.pause()
196
+ }
197
+ },
198
+ // 当一个轮播item为视频时,获取它的视频海报
199
+ getPoster(item) {
200
+ return typeof item === 'object' && item.poster ? item.poster : ''
201
+ },
202
+ // 点击某个item
203
+ clickHandler(index) {
204
+ this.$emit('click', index)
205
+ }
206
+ },
207
+ }
208
+ </script>
209
+
210
+ <style lang="scss" scoped>
211
+ $show-lines: 1;
212
+ @import '../../libs/css/variable.scss';
213
+ @import '../../libs/css/components.scss';
214
+ .uv-swiper {
215
+ @include flex;
216
+ justify-content: center;
217
+ align-items: center;
218
+ position: relative;
219
+ overflow: hidden;
220
+
221
+ &__wrapper {
222
+ flex: 1;
223
+
224
+ &__item {
225
+ flex: 1;
226
+
227
+ &__wrapper {
228
+ @include flex;
229
+ position: relative;
230
+ overflow: hidden;
231
+ transition: transform 0.3s;
232
+ flex: 1;
233
+
234
+ &__image {
235
+ flex: 1;
236
+ }
237
+
238
+ &__video {
239
+ flex: 1;
240
+ }
241
+
242
+ &__title {
243
+ position: absolute;
244
+ background-color: rgba(0, 0, 0, 0.3);
245
+ bottom: 0;
246
+ left: 0;
247
+ right: 0;
248
+ font-size: 28rpx;
249
+ height: 60rpx;
250
+ line-height: 60rpx;
251
+ color: #FFFFFF;
252
+ flex: 1;
253
+ }
254
+ }
255
+ }
256
+ }
257
+
258
+ &__indicator {
259
+ position: absolute;
260
+ bottom: 10px;
261
+ }
262
+ }
263
+ </style>
@@ -0,0 +1,30 @@
1
+ export default {
2
+ props: {
3
+ // 轮播的长度
4
+ length: {
5
+ type: [String, Number],
6
+ default: 0
7
+ },
8
+ // 当前处于活动状态的轮播的索引
9
+ current: {
10
+ type: [String, Number],
11
+ default: 0
12
+ },
13
+ // 指示器非激活颜色
14
+ indicatorActiveColor: {
15
+ type: String,
16
+ default: ''
17
+ },
18
+ // 指示器的激活颜色
19
+ indicatorInactiveColor: {
20
+ type: String,
21
+ default: ''
22
+ },
23
+ // 指示器模式,line-线型,dot-点型
24
+ indicatorMode: {
25
+ type: String,
26
+ default: ''
27
+ },
28
+ ...uni.$uv?.props?.swiperIndicator
29
+ }
30
+ }
@@ -0,0 +1,112 @@
1
+ <template>
2
+ <view class="uv-swiper-indicator">
3
+ <view
4
+ class="uv-swiper-indicator__wrapper"
5
+ v-if="indicatorMode === 'line'"
6
+ :class="[`uv-swiper-indicator__wrapper--${indicatorMode}`]"
7
+ :style="{
8
+ width: $uv.addUnit(lineWidth * length),
9
+ backgroundColor: indicatorInactiveColor
10
+ }"
11
+ >
12
+ <view
13
+ class="uv-swiper-indicator__wrapper--line__bar"
14
+ :style="[lineStyle]"
15
+ ></view>
16
+ </view>
17
+ <view
18
+ class="uv-swiper-indicator__wrapper"
19
+ v-if="indicatorMode === 'dot'"
20
+ >
21
+ <view
22
+ class="uv-swiper-indicator__wrapper__dot"
23
+ v-for="(item, index) in length"
24
+ :key="index"
25
+ :class="[index === current && 'uv-swiper-indicator__wrapper__dot--active']"
26
+ :style="[dotStyle(index)]"
27
+ >
28
+
29
+ </view>
30
+ </view>
31
+ </view>
32
+ </template>
33
+
34
+ <script>
35
+ import mpMixin from '../../libs/mixin/mpMixin.js'
36
+ import mixin from '../../libs/mixin/mixin.js'
37
+ import props from './props.js';
38
+ /**
39
+ * SwiperIndicator 轮播图指示器
40
+ * @description 该组件一般用于导航轮播,广告展示等场景,可开箱即用,
41
+ * @tutorial https://www.uvui.cn/components/swiper.html
42
+ * @property {String | Number} length 轮播的长度(默认 0 )
43
+ * @property {String | Number} current 当前处于活动状态的轮播的索引(默认 0 )
44
+ * @property {String} indicatorActiveColor 指示器非激活颜色
45
+ * @property {String} indicatorInactiveColor 指示器的激活颜色
46
+ * @property {String} indicatorMode 指示器模式(默认 'line' )
47
+ * @example <uv-swiper :list="list4" indicator keyName="url" :autoplay="false"></uv-swiper>
48
+ */
49
+ export default {
50
+ name: 'uv-swiper-indicator',
51
+ mixins: [mpMixin, mixin, props],
52
+ data() {
53
+ return {
54
+ lineWidth: 22
55
+ }
56
+ },
57
+ computed: {
58
+ // 指示器为线型的样式
59
+ lineStyle() {
60
+ let style = {}
61
+ style.width = this.$uv.addUnit(this.lineWidth)
62
+ style.transform = `translateX(${ this.$uv.addUnit(this.current * this.lineWidth) })`
63
+ style.backgroundColor = this.indicatorActiveColor
64
+ return style
65
+ },
66
+ // 指示器为点型的样式
67
+ dotStyle() {
68
+ return index => {
69
+ let style = {}
70
+ style.backgroundColor = index === this.current ? this.indicatorActiveColor : this.indicatorInactiveColor
71
+ return style
72
+ }
73
+ }
74
+ },
75
+ }
76
+ </script>
77
+
78
+ <style lang="scss" scoped>
79
+ @import '../../libs/css/components.scss';
80
+
81
+ .uv-swiper-indicator {
82
+
83
+ &__wrapper {
84
+ @include flex;
85
+
86
+ &--line {
87
+ border-radius: 100px;
88
+ height: 4px;
89
+
90
+ &__bar {
91
+ width: 22px;
92
+ height: 4px;
93
+ border-radius: 100px;
94
+ background-color: #FFFFFF;
95
+ transition: transform 0.3s;
96
+ }
97
+ }
98
+
99
+ &__dot {
100
+ width: 5px;
101
+ height: 5px;
102
+ border-radius: 100px;
103
+ margin: 0 4px;
104
+
105
+ &--active {
106
+ width: 12px;
107
+ }
108
+ }
109
+
110
+ }
111
+ }
112
+ </style>
@@ -0,0 +1,58 @@
1
+ export default {
2
+ props: {
3
+ value: {
4
+ type: [Boolean, String, Number],
5
+ default: false
6
+ },
7
+ modelValue: {
8
+ type: [Boolean, String, Number],
9
+ default: false
10
+ },
11
+ // 是否为加载中状态
12
+ loading: {
13
+ type: Boolean,
14
+ default: false
15
+ },
16
+ // 是否为禁用装填
17
+ disabled: {
18
+ type: Boolean,
19
+ default: false
20
+ },
21
+ // 开关尺寸,单位px
22
+ size: {
23
+ type: [String, Number],
24
+ default: 25
25
+ },
26
+ // 打开时的背景颜色
27
+ activeColor: {
28
+ type: String,
29
+ default: '#2979ff'
30
+ },
31
+ // 关闭时的背景颜色
32
+ inactiveColor: {
33
+ type: String,
34
+ default: '#fff'
35
+ },
36
+ // switch打开时的值
37
+ activeValue: {
38
+ type: [String, Number, Boolean],
39
+ default: true
40
+ },
41
+ // switch关闭时的值
42
+ inactiveValue: {
43
+ type: [String, Number, Boolean],
44
+ default: false
45
+ },
46
+ // 是否开启异步变更,开启后需要手动控制输入值
47
+ asyncChange: {
48
+ type: Boolean,
49
+ default: false
50
+ },
51
+ // 圆点与外边框的距离
52
+ space: {
53
+ type: [String, Number],
54
+ default: 0
55
+ },
56
+ ...uni.$uv?.props?.switch
57
+ }
58
+ }