@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,280 @@
1
+
2
+ <template>
3
+ <uv-popup
4
+ ref="popup"
5
+ mode="bottom"
6
+ :safeAreaInsetBottom="safeAreaInsetBottom"
7
+ :round="round"
8
+ :close-on-click-overlay="closeOnClickOverlay"
9
+ @change="popupChange"
10
+ >
11
+ <view class="uv-action-sheet">
12
+ <view
13
+ class="uv-action-sheet__header"
14
+ v-if="title"
15
+ >
16
+ <text class="uv-action-sheet__header__title uv-line-1">{{title}}</text>
17
+ <view
18
+ class="uv-action-sheet__header__icon-wrap"
19
+ @tap.stop="cancel"
20
+ >
21
+ <uv-icon
22
+ name="close"
23
+ size="17"
24
+ color="#c8c9cc"
25
+ bold
26
+ ></uv-icon>
27
+ </view>
28
+ </view>
29
+ <text
30
+ class="uv-action-sheet__description"
31
+ :style="[{
32
+ marginTop: `${title && description ? 0 : '18px'}`
33
+ }]"
34
+ v-if="description"
35
+ >{{description}}</text>
36
+ <slot>
37
+ <uv-line v-if="description"></uv-line>
38
+ <view class="uv-action-sheet__item-wrap">
39
+ <view v-for="(item, index) in actions" :key="index">
40
+ <!-- #ifdef MP -->
41
+ <button
42
+ class="uv-reset-button"
43
+ :openType="item.openType"
44
+ @getuserinfo="onGetUserInfo"
45
+ @contact="onContact"
46
+ @getphonenumber="onGetPhoneNumber"
47
+ @error="onError"
48
+ @launchapp="onLaunchApp"
49
+ @opensetting="onOpenSetting"
50
+ :lang="lang"
51
+ :session-from="sessionFrom"
52
+ :send-message-title="sendMessageTitle"
53
+ :send-message-path="sendMessagePath"
54
+ :send-message-img="sendMessageImg"
55
+ :show-message-card="showMessageCard"
56
+ :app-parameter="appParameter"
57
+ @tap="selectHandler(index)"
58
+ :hover-class="!item.disabled && !item.loading ? 'uv-action-sheet--hover' : ''"
59
+ >
60
+ <!-- #endif -->
61
+ <view
62
+ class="uv-action-sheet__item-wrap__item"
63
+ @tap.stop="selectHandler(index)"
64
+ :hover-class="!item.disabled && !item.loading ? 'uv-action-sheet--hover' : ''"
65
+ :hover-stay-time="150"
66
+ >
67
+ <template v-if="!item.loading">
68
+ <text
69
+ class="uv-action-sheet__item-wrap__item__name"
70
+ :style="[itemStyle(index)]"
71
+ >{{ item.name }}</text>
72
+ <text
73
+ v-if="item.subname"
74
+ class="uv-action-sheet__item-wrap__item__subname"
75
+ >{{ item.subname }}</text>
76
+ </template>
77
+ <uv-loading-icon
78
+ v-else
79
+ custom-class="van-action-sheet__loading"
80
+ size="18"
81
+ mode="circle"
82
+ />
83
+ </view>
84
+ <!-- #ifdef MP -->
85
+ </button>
86
+ <!-- #endif -->
87
+ <uv-line v-if="index !== actions.length - 1"></uv-line>
88
+ </view>
89
+ </view>
90
+ </slot>
91
+ <uv-gap
92
+ bgColor="#eaeaec"
93
+ height="6"
94
+ v-if="cancelText"
95
+ ></uv-gap>
96
+ <view hover-class="uv-action-sheet--hover">
97
+ <text
98
+ @touchmove.stop.prevent
99
+ :hover-stay-time="150"
100
+ v-if="cancelText"
101
+ class="uv-action-sheet__cancel-text"
102
+ @tap="cancel"
103
+ >{{cancelText}}</text>
104
+ </view>
105
+ </view>
106
+ </uv-popup>
107
+ </template>
108
+
109
+ <script>
110
+ import mpMixin from '../../libs/mixin/mpMixin.js'
111
+ import mixin from '../../libs/mixin/mixin.js'
112
+ import button from '../../libs/mixin/button.js'
113
+ import openType from '../../libs/mixin/openType.js'
114
+ import props from './props.js';
115
+ /**
116
+ * ActionSheet 操作菜单
117
+ * @description 本组件用于从底部弹出一个操作菜单,供用户选择并返回结果。本组件功能类似于uni的uni.showActionSheetAPI,配置更加灵活,所有平台都表现一致。
118
+ * @tutorial https://www.uvui.cn/components/actionSheet.html
119
+ * @property {Boolean} show 操作菜单是否展示 (默认 false )
120
+ * @property {String} title 操作菜单标题
121
+ * @property {String} description 选项上方的描述信息
122
+ * @property {Array<Object>} actions 按钮的文字数组,见官方文档示例
123
+ * @property {String} cancelText 取消按钮的提示文字,不为空时显示按钮
124
+ * @property {Boolean} closeOnClickAction 点击某个菜单项时是否关闭弹窗 (默认 true )
125
+ * @property {Boolean} safeAreaInsetBottom 处理底部安全区 (默认 true )
126
+ * @property {String} openType 小程序的打开方式 (contact | launchApp | getUserInfo | openSetting |getPhoneNumber |error )
127
+ * @property {Boolean} closeOnClickOverlay 点击遮罩是否允许关闭 (默认 true )
128
+ * @property {String} lang 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文
129
+ * @property {String} sessionFrom 会话来源,openType="contact"时有效
130
+ * @property {String} sendMessageTitle 会话内消息卡片标题,openType="contact"时有效
131
+ * @property {String} sendMessagePath 会话内消息卡片点击跳转小程序路径,openType="contact"时有效
132
+ * @property {String} sendMessageImg 会话内消息卡片图片,openType="contact"时有效
133
+ * @property {Boolean} showMessageCard 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效 (默认 false )
134
+ * @property {String} appParameter 打开 APP 时,向 APP 传递的参数,openType=launchApp 时有效
135
+ *
136
+ * @event {Function} select 点击ActionSheet列表项时触发
137
+ * @event {Function} close 点击取消按钮时触发
138
+ * @event {Function} getuserinfo 用户点击该按钮时,会返回获取到的用户信息,回调的 detail 数据与 wx.getUserInfo 返回的一致,openType="getUserInfo"时有效
139
+ * @event {Function} contact 客服消息回调,openType="contact"时有效
140
+ * @event {Function} getphonenumber 获取用户手机号回调,openType="getPhoneNumber"时有效
141
+ * @event {Function} error 当使用开放能力时,发生错误的回调,openType="error"时有效
142
+ * @event {Function} launchapp 打开 APP 成功的回调,openType="launchApp"时有效
143
+ * @event {Function} opensetting 在打开授权设置页后回调,openType="openSetting"时有效
144
+ * @example <uv-action-sheet ref="actionSheet" :actions="list" :title="title" ></uv-action-sheet>
145
+ */
146
+ export default {
147
+ name: "uv-action-sheet",
148
+ mixins: [openType, button, mpMixin , mixin, props],
149
+ emits: ['close', 'select'],
150
+ computed: {
151
+ // 操作项目的样式
152
+ itemStyle() {
153
+ return (index) => {
154
+ let style = {};
155
+ if (this.actions[index].color) style.color = this.actions[index].color
156
+ if (this.actions[index].fontSize) style.fontSize = this.$uv.addUnit(this.actions[index].fontSize)
157
+ // 选项被禁用的样式
158
+ if (this.actions[index].disabled) style.color = '#c0c4cc'
159
+ return style;
160
+ }
161
+ },
162
+ },
163
+ methods: {
164
+ open() {
165
+ this.$refs.popup.open();
166
+ },
167
+ close() {
168
+ this.$refs.popup.close();
169
+ },
170
+ popupChange(e) {
171
+ if(!e.show) this.$emit('close');
172
+ },
173
+ // 点击取消按钮
174
+ cancel() {
175
+ this.close();
176
+ },
177
+ selectHandler(index) {
178
+ const item = this.actions[index]
179
+ if (item && !item.disabled && !item.loading) {
180
+ this.$emit('select', item)
181
+ if (this.closeOnClickAction) {
182
+ this.close();
183
+ }
184
+ }
185
+ },
186
+ }
187
+ }
188
+ </script>
189
+
190
+ <style lang="scss" scoped>
191
+ $show-lines: 1;
192
+ $show-reset-button: 1;
193
+ @import '../../libs/css/variable.scss';
194
+ @import '../../libs/css/components.scss';
195
+ @import '../../libs/css/color.scss';
196
+ $uv-action-sheet-reset-button-width:100% !default;
197
+ $uv-action-sheet-title-font-size: 16px !default;
198
+ $uv-action-sheet-title-padding: 12px 30px !default;
199
+ $uv-action-sheet-title-color: $uv-main-color !default;
200
+ $uv-action-sheet-header-icon-wrap-right:15px !default;
201
+ $uv-action-sheet-header-icon-wrap-top:15px !default;
202
+ $uv-action-sheet-description-font-size:13px !default;
203
+ $uv-action-sheet-description-color:14px !default;
204
+ $uv-action-sheet-description-margin: 18px 15px !default;
205
+ $uv-action-sheet-item-wrap-item-padding:15px !default;
206
+ $uv-action-sheet-item-wrap-name-font-size:16px !default;
207
+ $uv-action-sheet-item-wrap-subname-font-size:13px !default;
208
+ $uv-action-sheet-item-wrap-subname-color: #c0c4cc !default;
209
+ $uv-action-sheet-item-wrap-subname-margin-top:10px !default;
210
+ $uv-action-sheet-cancel-text-font-size:16px !default;
211
+ $uv-action-sheet-cancel-text-color:$uv-content-color !default;
212
+ $uv-action-sheet-cancel-text-font-size:15px !default;
213
+ $uv-action-sheet-cancel-text-hover-background-color:rgb(242, 243, 245) !default;
214
+
215
+ .uv-reset-button {
216
+ width: $uv-action-sheet-reset-button-width;
217
+ }
218
+
219
+ .uv-action-sheet {
220
+ text-align: center;
221
+ &__header {
222
+ position: relative;
223
+ padding: $uv-action-sheet-title-padding;
224
+ &__title {
225
+ font-size: $uv-action-sheet-title-font-size;
226
+ color: $uv-action-sheet-title-color;
227
+ font-weight: bold;
228
+ text-align: center;
229
+ }
230
+
231
+ &__icon-wrap {
232
+ position: absolute;
233
+ right: $uv-action-sheet-header-icon-wrap-right;
234
+ top: $uv-action-sheet-header-icon-wrap-top;
235
+ }
236
+ }
237
+
238
+ &__description {
239
+ font-size: $uv-action-sheet-description-font-size;
240
+ color: $uv-tips-color;
241
+ margin: $uv-action-sheet-description-margin;
242
+ text-align: center;
243
+ }
244
+
245
+ &__item-wrap {
246
+
247
+ &__item {
248
+ padding: $uv-action-sheet-item-wrap-item-padding;
249
+ @include flex;
250
+ align-items: center;
251
+ justify-content: center;
252
+ flex-direction: column;
253
+
254
+ &__name {
255
+ font-size: $uv-action-sheet-item-wrap-name-font-size;
256
+ color: $uv-main-color;
257
+ text-align: center;
258
+ }
259
+
260
+ &__subname {
261
+ font-size: $uv-action-sheet-item-wrap-subname-font-size;
262
+ color: $uv-action-sheet-item-wrap-subname-color;
263
+ margin-top: $uv-action-sheet-item-wrap-subname-margin-top;
264
+ text-align: center;
265
+ }
266
+ }
267
+ }
268
+
269
+ &__cancel-text {
270
+ font-size: $uv-action-sheet-cancel-text-font-size;
271
+ color: $uv-action-sheet-cancel-text-color;
272
+ text-align: center;
273
+ padding: $uv-action-sheet-cancel-text-font-size;
274
+ }
275
+
276
+ &--hover {
277
+ background-color: $uv-action-sheet-cancel-text-hover-background-color;
278
+ }
279
+ }
280
+ </style>
@@ -0,0 +1,312 @@
1
+ <template>
2
+ <view class="uv-album">
3
+ <view
4
+ class="uv-album__row"
5
+ ref="uv-album__row"
6
+ v-for="(arr, index) in showUrls"
7
+ :forComputedUse="albumWidth"
8
+ :key="index"
9
+ >
10
+ <view
11
+ class="uv-album__row__wrapper"
12
+ v-for="(item, index1) in arr"
13
+ :key="index1"
14
+ :style="[imageStyle(index + 1, index1 + 1)]"
15
+ @tap="previewFullImage ? onPreviewTap(getSrc(item)) : ''"
16
+ >
17
+ <image
18
+ :src="getSrc(item)"
19
+ :mode="
20
+ urls.length === 1
21
+ ? imageHeight > 0
22
+ ? singleMode
23
+ : 'widthFix'
24
+ : multipleMode
25
+ "
26
+ :style="[
27
+ {
28
+ width: imageWidth,
29
+ height: imageHeight
30
+ }
31
+ ]"
32
+ ></image>
33
+ <view
34
+ v-if="
35
+ showMore &&
36
+ urls.length > rowCount * showUrls.length &&
37
+ index === showUrls.length - 1 &&
38
+ index1 === showUrls[showUrls.length - 1].length - 1
39
+ "
40
+ class="uv-album__row__wrapper__text"
41
+ >
42
+ <uv-text
43
+ :text="`+${urls.length - maxCount}`"
44
+ color="#fff"
45
+ :size="$uv.getPx(multipleSize) * 0.3"
46
+ align="center"
47
+ customStyle="justify-content: center"
48
+ ></uv-text>
49
+ </view>
50
+ </view>
51
+ </view>
52
+ </view>
53
+ </template>
54
+ <script>
55
+ import mpMixin from '../../libs/mixin/mpMixin.js'
56
+ import mixin from '../../libs/mixin/mixin.js'
57
+ // #ifdef APP-NVUE
58
+ // 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度
59
+ const dom = uni.requireNativePlugin('dom')
60
+ // #endif
61
+
62
+ /**
63
+ * Album 相册
64
+ * @description 本组件提供一个类似相册的功能,让开发者开发起来更加得心应手。减少重复的模板代码
65
+ * @tutorial https://www.uvui.cn/components/album.html
66
+ * @property {Array} urls 图片地址列表 Array<String>|Array<Object>形式
67
+ * @property {String} keyName 指定从数组的对象元素中读取哪个属性作为图片地址
68
+ * @property {String | Number} singleSize 单图时,图片长边的长度 (默认 180 )
69
+ * @property {String | Number} multipleSize 多图时,图片边长 (默认 70 )
70
+ * @property {String | Number} space 多图时,图片水平和垂直之间的间隔 (默认 6 )
71
+ * @property {String} singleMode 单图时,图片缩放裁剪的模式 (默认 'scaleToFill' )
72
+ * @property {String} multipleMode 多图时,图片缩放裁剪的模式 (默认 'aspectFill' )
73
+ * @property {String | Number} maxCount 取消按钮的提示文字 (默认 9 )
74
+ * @property {Boolean} previewFullImage 是否可以预览图片 (默认 true )
75
+ * @property {String | Number} rowCount 每行展示图片数量,如设置,singleSize和multipleSize将会无效 (默认 3 )
76
+ * @property {Boolean} showMore 超出maxCount时是否显示查看更多的提示 (默认 true )
77
+ *
78
+ * @event {Function} albumWidth 某些特殊的情况下,需要让文字与相册的宽度相等,这里事件的形式对外发送 (回调参数 width )
79
+ * @example <uv-album :urls="urls2" @albumWidth="width => albumWidth = width" multipleSize="68" ></uv-album>
80
+ */
81
+ export default {
82
+ name: 'uv-album',
83
+ mixins: [mpMixin, mixin],
84
+ emits: ['albumWidth'],
85
+ props: {
86
+ // 图片地址,Array<String>|Array<Object>形式
87
+ urls: {
88
+ type: Array,
89
+ default: () => []
90
+ },
91
+ // 指定从数组的对象元素中读取哪个属性作为图片地址
92
+ keyName: {
93
+ type: String,
94
+ default: ''
95
+ },
96
+ // 单图时,图片长边的长度
97
+ singleSize: {
98
+ type: [String, Number],
99
+ default: 180
100
+ },
101
+ // 多图时,图片边长
102
+ multipleSize: {
103
+ type: [String, Number],
104
+ default: 70
105
+ },
106
+ // 多图时,图片水平和垂直之间的间隔
107
+ space: {
108
+ type: [String, Number],
109
+ default: 6
110
+ },
111
+ // 单图时,图片缩放裁剪的模式
112
+ singleMode: {
113
+ type: String,
114
+ default: 'scaleToFill'
115
+ },
116
+ // 多图时,图片缩放裁剪的模式
117
+ multipleMode: {
118
+ type: String,
119
+ default: 'aspectFill'
120
+ },
121
+ // 最多展示的图片数量,超出时最后一个位置将会显示剩余图片数量
122
+ maxCount: {
123
+ type: [String, Number],
124
+ default: 9
125
+ },
126
+ // 是否可以预览图片
127
+ previewFullImage: {
128
+ type: Boolean,
129
+ default: true
130
+ },
131
+ // 每行展示图片数量,如设置,singleSize和multipleSize将会无效
132
+ rowCount: {
133
+ type: [String, Number],
134
+ default: 3
135
+ },
136
+ // 超出maxCount时是否显示查看更多的提示
137
+ showMore: {
138
+ type: Boolean,
139
+ default: true
140
+ },
141
+ ...uni.$uv?.props?.album
142
+ },
143
+ data() {
144
+ return {
145
+ // 单图的宽度
146
+ singleWidth: 0,
147
+ // 单图的高度
148
+ singleHeight: 0,
149
+ // 单图时,如果无法获取图片的尺寸信息,让图片宽度默认为容器的一定百分比
150
+ singlePercent: 0.6
151
+ }
152
+ },
153
+ watch: {
154
+ urls: {
155
+ immediate: true,
156
+ handler(newVal) {
157
+ if (newVal.length === 1) {
158
+ this.getImageRect()
159
+ }
160
+ }
161
+ }
162
+ },
163
+ computed: {
164
+ imageStyle() {
165
+ return (index1, index2) => {
166
+ const { space, rowCount, multipleSize, urls } = this;
167
+ const rowLen = this.showUrls.length;
168
+ const allLen = this.urls.length;
169
+ const style = {
170
+ marginRight: this.$uv.addUnit(space),
171
+ marginBottom: this.$uv.addUnit(space)
172
+ }
173
+ // 如果为最后一行,则每个图片都无需下边框
174
+ if (index1 === rowLen) style.marginBottom = 0
175
+ // 每行的最右边一张和总长度的最后一张无需右边框
176
+ if (
177
+ index2 === rowCount ||
178
+ (index1 === rowLen &&
179
+ index2 === this.showUrls[index1 - 1].length)
180
+ )
181
+ style.marginRight = 0
182
+ return style
183
+ }
184
+ },
185
+ // 将数组划分为二维数组
186
+ showUrls() {
187
+ const arr = []
188
+ this.urls.map((item, index) => {
189
+ // 限制最大展示数量
190
+ if (index + 1 <= this.maxCount) {
191
+ // 计算该元素为第几个素组内
192
+ const itemIndex = Math.floor(index / this.rowCount)
193
+ // 判断对应的索引是否存在
194
+ if (!arr[itemIndex]) {
195
+ arr[itemIndex] = []
196
+ }
197
+ arr[itemIndex].push(item)
198
+ }
199
+ })
200
+ return arr
201
+ },
202
+ imageWidth() {
203
+ return this.$uv.addUnit(
204
+ this.urls.length === 1 ? this.singleWidth : this.multipleSize
205
+ )
206
+ },
207
+ imageHeight() {
208
+ return this.$uv.addUnit(
209
+ this.urls.length === 1 ? this.singleHeight : this.multipleSize
210
+ )
211
+ },
212
+ // 此变量无实际用途,仅仅是为了利用computed特性,让其在urls长度等变化时,重新计算图片的宽度
213
+ // 因为用户在某些特殊的情况下,需要让文字与相册的宽度相等,所以这里事件的形式对外发送
214
+ albumWidth() {
215
+ let width = 0
216
+ if (this.urls.length === 1) {
217
+ width = this.singleWidth
218
+ } else {
219
+ width =
220
+ this.showUrls[0].length * this.$uv.getPx(this.multipleSize) +
221
+ this.$uv.getPx(this.space) * (this.showUrls[0].length - 1)
222
+ }
223
+ this.$emit('albumWidth', width)
224
+ return width
225
+ }
226
+ },
227
+ methods: {
228
+ // 预览图片
229
+ onPreviewTap(url) {
230
+ const urls = this.urls.map((item) => {
231
+ return this.getSrc(item)
232
+ })
233
+ uni.previewImage({
234
+ current: url,
235
+ urls
236
+ })
237
+ },
238
+ // 获取图片的路径
239
+ getSrc(item) {
240
+ return this.$uv.test.object(item) ?
241
+ (this.keyName && item[this.keyName]) || item.src :
242
+ item
243
+ },
244
+ // 单图时,获取图片的尺寸
245
+ // 在小程序中,需要将网络图片的的域名添加到小程序的download域名才可能获取尺寸
246
+ // 在没有添加的情况下,让单图宽度默认为盒子的一定宽度(singlePercent)
247
+ getImageRect() {
248
+ const src = this.getSrc(this.urls[0])
249
+ uni.getImageInfo({
250
+ src,
251
+ success: (res) => {
252
+ // 判断图片横向还是竖向展示方式
253
+ const isHorizotal = res.width >= res.height
254
+ this.singleWidth = isHorizotal ?
255
+ this.singleSize :
256
+ (res.width / res.height) * this.$uv.getPx(this.singleSize)
257
+ this.singleHeight = !isHorizotal ?
258
+ this.singleSize :
259
+ (res.height / res.width) * this.singleWidth
260
+ },
261
+ fail: () => {
262
+ this.getComponentWidth()
263
+ }
264
+ })
265
+ },
266
+ // 获取组件的宽度
267
+ async getComponentWidth() {
268
+ // 延时一定时间,以获取dom尺寸
269
+ await this.$uv.sleep(30)
270
+ // #ifndef APP-NVUE
271
+ this.$uGetRect('.uv-album__row').then((size) => {
272
+ this.singleWidth = size.width * this.singlePercent
273
+ })
274
+ // #endif
275
+
276
+ // #ifdef APP-NVUE
277
+ // 这里ref="uv-album__row"所在的标签为通过for循环出来,导致this.$refs['uv-album__row']是一个数组
278
+ const ref = this.$refs['uv-album__row'][0]
279
+ ref &&
280
+ dom.getComponentRect(ref, (res) => {
281
+ this.singleWidth = res.size.width * this.singlePercent
282
+ })
283
+ // #endif
284
+ }
285
+ }
286
+ }
287
+ </script>
288
+
289
+ <style lang="scss" scoped>
290
+ @import '../../libs/css/components.scss';
291
+ .uv-album {
292
+ @include flex(column);
293
+ &__row {
294
+ @include flex(row);
295
+ flex-wrap: wrap;
296
+ &__wrapper {
297
+ position: relative;
298
+ &__text {
299
+ position: absolute;
300
+ top: 0;
301
+ left: 0;
302
+ right: 0;
303
+ bottom: 0;
304
+ background-color: rgba(0, 0, 0, 0.3);
305
+ @include flex(row);
306
+ justify-content: center;
307
+ align-items: center;
308
+ }
309
+ }
310
+ }
311
+ }
312
+ </style>
@@ -0,0 +1,45 @@
1
+ export default {
2
+ props: {
3
+ // 显示文字
4
+ title: {
5
+ type: String,
6
+ default: ''
7
+ },
8
+ // 主题,success/warning/info/error
9
+ type: {
10
+ type: String,
11
+ default: 'warning'
12
+ },
13
+ // 辅助性文字
14
+ description: {
15
+ type: String,
16
+ default: ''
17
+ },
18
+ // 是否可关闭
19
+ closable: {
20
+ type: Boolean,
21
+ default: false
22
+ },
23
+ // 是否显示图标
24
+ showIcon: {
25
+ type: Boolean,
26
+ default: false
27
+ },
28
+ // 浅或深色调,light-浅色,dark-深色
29
+ effect: {
30
+ type: String,
31
+ default: 'light'
32
+ },
33
+ // 文字是否居中
34
+ center: {
35
+ type: Boolean,
36
+ default: false
37
+ },
38
+ // 字体大小
39
+ fontSize: {
40
+ type: [String, Number],
41
+ default: 14
42
+ },
43
+ ...uni.$uv?.props?.alert
44
+ }
45
+ }