@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,96 @@
1
+ <template>
2
+ <view class="uv-loading-page uv-flex-column" v-if="showLoading" :style="[loadingPageStyle]">
3
+ <image v-if="image!=''" :src="image" class="uv-loading-page__img" mode="widthFit" :style="[{
4
+ width: $uv.addUnit(iconSize),
5
+ height: $uv.addUnit(iconSize)
6
+ }]"></image>
7
+ <uv-loading-icon v-else :mode="loadingMode" :size="iconSize" :color="loadingColor"></uv-loading-icon>
8
+ <slot>
9
+ <text class="uv-loading-page__text" :style="[{
10
+ fontSize: $uv.addUnit(fontSize),
11
+ color: color
12
+ }]">{{ loadingText }}</text>
13
+ </slot>
14
+ </view>
15
+ </template>
16
+ <script>
17
+ import mpMixin from '../../libs/mixin/mpMixin.js'
18
+ import mixin from '../../libs/mixin/mixin.js'
19
+ import props from "./props.js";
20
+ /**
21
+ * loadingPage 加载动画
22
+ * @description 警此组件为一个小动画,目前用在uvui的loadmore加载更多和switch开关等组件的正在加载状态场景。
23
+ * @tutorial https://www.uvui.cn/components/loading.html
24
+ *
25
+ * @property {Boolean} loading 是否加载中 (默认 false )
26
+ * @property {String | Number} loadingText 提示内容 (默认 '正在加载' )
27
+ * @property {String} image 文字上方用于替换loading动画的图片
28
+ * @property {String} loadingMode 加载动画的模式,circle-圆形,spinner-花朵形,semicircle-半圆形 (默认 'circle' )
29
+ * @property {String} bgColor 背景色 (默认 '#ffffff' )
30
+ * @property {String} color 文字颜色 (默认 '#C8C8C8' )
31
+ * @property {String | Number} fontSize 文字大小 (默认 19 )
32
+ * @property {String | Number} iconSize 图标大小 (默认 28 )
33
+ * @property {String} loadingColor 加载中图标的颜色,只能rgb或者十六进制颜色值 (默认 '#C8C8C8' )
34
+ * @property {String | Number} duration 关闭加载时的过渡时间,单位ms (默认 300 )
35
+ *
36
+ * @example <uv-loading mode="circle"></uv-loading>
37
+ */
38
+ export default {
39
+ name: "uv-loading-page",
40
+ mixins: [mpMixin, mixin, props],
41
+ data() {
42
+ return {
43
+ showLoading: false,
44
+ opacity: 1
45
+ }
46
+ },
47
+ watch: {
48
+ loading: {
49
+ immediate: true,
50
+ handler(newVal) {
51
+ if (newVal) {
52
+ this.showLoading = true;
53
+ this.opacity = 1;
54
+ } else {
55
+ this.opacity = 0;
56
+ this.$nextTick(() => {
57
+ this.$uv.sleep(this.duration).then(res => {
58
+ this.showLoading = false;
59
+ })
60
+ })
61
+ }
62
+ }
63
+ }
64
+ },
65
+ computed: {
66
+ loadingPageStyle() {
67
+ const style = {
68
+ 'position': 'fixed',
69
+ 'top': '0',
70
+ 'left': '0',
71
+ 'right': '0',
72
+ 'bottom': '0',
73
+ 'zIndex': '999',
74
+ 'background-color': this.bgColor,
75
+ 'transition-duration': `${this.duration}ms`,
76
+ 'opacity': this.opacity
77
+ }
78
+ return this.$uv.deepMerge(style, this.$uv.addStyle(this.customStyle))
79
+ }
80
+ }
81
+ }
82
+ </script>
83
+ <style scoped lang="scss">
84
+ @import '../../libs/css/components.scss';
85
+ $uv-loading-icon-margin-bottom: 10px !default;
86
+ .uv-loading-page {
87
+ flex: 1;
88
+ justify-content: center;
89
+ align-items: center;
90
+ padding-bottom: 150px;
91
+ transition-property: opacity;
92
+ &__text {
93
+ margin-top: $uv-loading-icon-margin-bottom;
94
+ }
95
+ }
96
+ </style>
@@ -0,0 +1,90 @@
1
+ export default {
2
+ props: {
3
+ // 标题
4
+ title: {
5
+ type: [String],
6
+ default: ''
7
+ },
8
+ // 弹窗内容
9
+ content: {
10
+ type: String,
11
+ default: ''
12
+ },
13
+ // 确认文案
14
+ confirmText: {
15
+ type: String,
16
+ default: '确认'
17
+ },
18
+ // 取消文案
19
+ cancelText: {
20
+ type: String,
21
+ default: '取消'
22
+ },
23
+ // 是否显示确认按钮
24
+ showConfirmButton: {
25
+ type: Boolean,
26
+ default: true
27
+ },
28
+ // 是否显示取消按钮
29
+ showCancelButton: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ // 确认按钮颜色
34
+ confirmColor: {
35
+ type: String,
36
+ default: '#2979ff'
37
+ },
38
+ // 取消文字颜色
39
+ cancelColor: {
40
+ type: String,
41
+ default: '#606266'
42
+ },
43
+ // 对调确认和取消的位置
44
+ buttonReverse: {
45
+ type: Boolean,
46
+ default: false
47
+ },
48
+ // 是否开启缩放效果
49
+ zoom: {
50
+ type: Boolean,
51
+ default: true
52
+ },
53
+ // 层级
54
+ zIndex: {
55
+ type: [String, Number],
56
+ default: 10075
57
+ },
58
+ // 是否异步关闭,只对确定按钮有效
59
+ asyncClose: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ // 是否允许点击遮罩关闭modal
64
+ closeOnClickOverlay: {
65
+ type: Boolean,
66
+ default: true
67
+ },
68
+ // 给一个负的margin-top,往上偏移,避免和键盘重合的情况
69
+ negativeTop: {
70
+ type: [String, Number],
71
+ default: 0
72
+ },
73
+ // modal宽度,不支持百分比,可以数值,px,rpx单位
74
+ width: {
75
+ type: [String, Number],
76
+ default: '650rpx'
77
+ },
78
+ // 文本对齐方式,默认left
79
+ align: {
80
+ type: String,
81
+ default: 'left'
82
+ },
83
+ // 文本自定义样式
84
+ textStyle: {
85
+ type: [Object, String],
86
+ default: ''
87
+ },
88
+ ...uni.$uv?.props?.modal
89
+ }
90
+ }
@@ -0,0 +1,245 @@
1
+ <template>
2
+ <uv-popup
3
+ ref="modalPopup"
4
+ mode="center"
5
+ :zoom="zoom"
6
+ :zIndex="zIndex"
7
+ :customStyle="{
8
+ borderRadius: '6px',
9
+ overflow: 'hidden',
10
+ marginTop: `-${$uv.addUnit(negativeTop)}`
11
+ }"
12
+ :closeOnClickOverlay="closeOnClickOverlay"
13
+ :safeAreaInsetBottom="false"
14
+ :duration="400"
15
+ @change="popupChange"
16
+ >
17
+ <view
18
+ class="uv-modal"
19
+ :style="{
20
+ width: $uv.addUnit(width),
21
+ }"
22
+ >
23
+ <text
24
+ class="uv-modal__title"
25
+ v-if="title"
26
+ >{{ title }}</text>
27
+ <view
28
+ class="uv-modal__content"
29
+ :style="{
30
+ paddingTop: `${title ? 12 : 25}px`
31
+ }"
32
+ >
33
+ <slot>
34
+ <text
35
+ class="uv-modal__content__text"
36
+ :style="[
37
+ {
38
+ textAlign: align
39
+ },
40
+ nvueStyle,
41
+ $uv.addStyle(textStyle)
42
+ ]"
43
+ >{{ content }}</text>
44
+ </slot>
45
+ </view>
46
+ <slot name="confirmButton">
47
+ <uv-line></uv-line>
48
+ <view
49
+ v-if="showConfirmButton || showCancelButton"
50
+ class="uv-modal__button-group"
51
+ :style="{
52
+ flexDirection: buttonReverse ? 'row-reverse' : 'row'
53
+ }"
54
+ >
55
+ <view
56
+ class="uv-modal__button-group__wrapper uv-modal__button-group__wrapper--cancel"
57
+ :hover-stay-time="150"
58
+ hover-class="uv-modal__button-group__wrapper--hover"
59
+ :class="[showCancelButton && !showConfirmButton && 'uv-modal__button-group__wrapper--only-cancel']"
60
+ v-if="showCancelButton"
61
+ @tap="cancelHandler"
62
+ >
63
+ <text
64
+ class="uv-modal__button-group__wrapper__text"
65
+ :style="{
66
+ color: cancelColor
67
+ }"
68
+ >{{ cancelText }}</text>
69
+ </view>
70
+ <uv-line
71
+ direction="column"
72
+ v-if="showConfirmButton && showCancelButton"
73
+ ></uv-line>
74
+ <view
75
+ class="uv-modal__button-group__wrapper uv-modal__button-group__wrapper--confirm"
76
+ :hover-stay-time="150"
77
+ hover-class="uv-modal__button-group__wrapper--hover"
78
+ :class="[!showCancelButton && showConfirmButton && 'uv-modal__button-group__wrapper--only-confirm']"
79
+ v-if="showConfirmButton"
80
+ @tap="confirmHandler"
81
+ >
82
+ <uv-loading-icon v-if="loading"></uv-loading-icon>
83
+ <text
84
+ v-else
85
+ class="uv-modal__button-group__wrapper__text"
86
+ :style="{
87
+ color: confirmColor
88
+ }"
89
+ >{{ confirmText }}</text>
90
+ </view>
91
+ </view>
92
+ </slot>
93
+ </view>
94
+ </uv-popup>
95
+ </template>
96
+
97
+ <script>
98
+ import mpMixin from '../../libs/mixin/mpMixin.js'
99
+ import mixin from '../../libs/mixin/mixin.js'
100
+ import props from './props.js';
101
+ /**
102
+ * Modal 模态框
103
+ * @description 弹出模态框,常用于消息提示、消息确认、在当前页面内完成特定的交互操作。
104
+ * @tutorial https://www.uvui.cn/components/modul.html
105
+ * @property {String} title 标题内容
106
+ * @property {String} content 模态框内容,如传入slot内容,则此参数无效
107
+ * @property {String} confirmText 确认按钮的文字 (默认 '确认' )
108
+ * @property {String} cancelText 取消按钮的文字 (默认 '取消' )
109
+ * @property {Boolean} showConfirmButton 是否显示确认按钮 (默认 true )
110
+ * @property {Boolean} showCancelButton 是否显示取消按钮 (默认 false )
111
+ * @property {String} confirmColor 确认按钮的颜色 (默认 '#2979ff' )
112
+ * @property {String} cancelColor 取消按钮的颜色 (默认 '#606266' )
113
+ * @property {Boolean} buttonReverse 对调确认和取消的位置 (默认 false )
114
+ * @property {Boolean} zoom 是否开启缩放模式 (默认 true )
115
+ * @property {Boolean} asyncClose 是否异步关闭,只对确定按钮有效,见上方说明 (默认 false )
116
+ * @property {Boolean} closeOnClickOverlay 是否允许点击遮罩关闭该组件 (默认 true )
117
+ * @property {String | Number} negativeTop 往上偏移的值,给一个负的margin-top,往上偏移,避免和键盘重合的情况,单位任意,数值则默认为px单位 (默认 0 )
118
+ * @property {String | Number} width modal宽度,不支持百分比,可以数值,px,rpx单位 (默认 '650rpx' )
119
+ * @property {String} align 文本对齐方式 (默认'left')
120
+ * @property {String | Object} textStyle 文本扩展样式
121
+ * @event {Function} confirm 点击确认按钮时触发
122
+ * @event {Function} cancel 点击取消按钮时触发
123
+ * @event {Function} close 点击遮罩关闭出发,closeOnClickOverlay为true有效
124
+ * @example <uv-modal ref="modalPopup" title="title" content="content"></uv-modal>
125
+ */
126
+ export default {
127
+ name: 'uv-modal',
128
+ mixins: [mpMixin, mixin, props],
129
+ data() {
130
+ return {
131
+ loading: false
132
+ }
133
+ },
134
+ computed: {
135
+ nvueStyle() {
136
+ const style = {};
137
+ // 避免nvue中不能换行的问题
138
+ // #ifdef APP-NVUE
139
+ style.width = this.$uv.addUnit(this.$uv.getPx(this.width) - 50,'px');
140
+ // #endif
141
+ return style;
142
+ }
143
+ },
144
+ methods: {
145
+ open() {
146
+ this.$refs.modalPopup.open();
147
+ if (this.loading) this.loading = false;
148
+ },
149
+ close() {
150
+ this.$refs.modalPopup.close();
151
+ },
152
+ popupChange(e) {
153
+ if(!e.show) this.$emit('close');
154
+ },
155
+ // 点击确定按钮
156
+ confirmHandler() {
157
+ if(!this.loading) {
158
+ this.$emit('confirm');
159
+ }
160
+ // 如果配置了异步关闭,将按钮值为loading状态
161
+ if (this.asyncClose) {
162
+ this.loading = true;
163
+ } else {
164
+ this.close();
165
+ }
166
+ },
167
+ // 点击取消按钮
168
+ cancelHandler() {
169
+ this.$emit('cancel');
170
+ this.close();
171
+ },
172
+ closeLoading() {
173
+ this.$nextTick(()=>{
174
+ this.loading = false;
175
+ })
176
+ }
177
+ }
178
+ }
179
+ </script>
180
+
181
+ <style lang="scss" scoped>
182
+ @import '../../libs/css/components.scss';
183
+ @import '../../libs/css/color.scss';
184
+ $uv-modal-border-radius: 6px;
185
+
186
+ .uv-modal {
187
+ width: 650rpx;
188
+ border-radius: $uv-modal-border-radius;
189
+ overflow: hidden;
190
+
191
+ &__title {
192
+ font-size: 16px;
193
+ font-weight: bold;
194
+ color: $uv-content-color;
195
+ text-align: center;
196
+ padding-top: 25px;
197
+ }
198
+
199
+ &__content {
200
+ padding: 12px 25px 25px 25px;
201
+ @include flex;
202
+ justify-content: center;
203
+
204
+ &__text {
205
+ line-height: 48rpx;
206
+ font-size: 15px;
207
+ color: $uv-content-color;
208
+ flex: 1;
209
+ }
210
+ }
211
+
212
+ &__button-group {
213
+ @include flex;
214
+ height: 48px;
215
+
216
+ &__wrapper {
217
+ flex: 1;
218
+ @include flex;
219
+ justify-content: center;
220
+ align-items: center;
221
+ height: 48px;
222
+
223
+ &--confirm,
224
+ &--only-cancel {
225
+ border-bottom-right-radius: $uv-modal-border-radius;
226
+ }
227
+
228
+ &--cancel,
229
+ &--only-confirm {
230
+ border-bottom-left-radius: $uv-modal-border-radius;
231
+ }
232
+
233
+ &--hover {
234
+ background-color: $uv-bg-color;
235
+ }
236
+
237
+ &__text {
238
+ color: $uv-content-color;
239
+ font-size: 16px;
240
+ text-align: center;
241
+ }
242
+ }
243
+ }
244
+ }
245
+ </style>
@@ -0,0 +1,89 @@
1
+ export default {
2
+ props: {
3
+ // 是否开启顶部安全区适配
4
+ safeAreaInsetTop: {
5
+ type: Boolean,
6
+ default: true
7
+ },
8
+ // 固定在顶部时,是否生成一个等高元素,以防止塌陷
9
+ placeholder: {
10
+ type: Boolean,
11
+ default: false
12
+ },
13
+ // 是否固定在顶部
14
+ fixed: {
15
+ type: Boolean,
16
+ default: true
17
+ },
18
+ // 是否显示下边框
19
+ border: {
20
+ type: Boolean,
21
+ default: false
22
+ },
23
+ // 左边的图标
24
+ leftIcon: {
25
+ type: String,
26
+ default: 'arrow-left'
27
+ },
28
+ // 左边的提示文字
29
+ leftText: {
30
+ type: String,
31
+ default: ''
32
+ },
33
+ // 左右的提示文字
34
+ rightText: {
35
+ type: String,
36
+ default: ''
37
+ },
38
+ // 右边的图标
39
+ rightIcon: {
40
+ type: String,
41
+ default: ''
42
+ },
43
+ // 标题
44
+ title: {
45
+ type: [String, Number],
46
+ default: ''
47
+ },
48
+ // 背景颜色
49
+ bgColor: {
50
+ type: String,
51
+ default: '#ffffff'
52
+ },
53
+ imgMode: {
54
+ type: String,
55
+ default: 'aspectFill'
56
+ },
57
+ // 标题的宽度
58
+ titleWidth: {
59
+ type: [String, Number],
60
+ default: '400rpx'
61
+ },
62
+ // 导航栏高度
63
+ height: {
64
+ type: [String, Number],
65
+ default: '44px'
66
+ },
67
+ // 左侧返回图标的大小
68
+ leftIconSize: {
69
+ type: [String, Number],
70
+ default: 20
71
+ },
72
+ // 左侧返回图标的颜色
73
+ leftIconColor: {
74
+ type: String,
75
+ default: '#303133'
76
+ },
77
+ // 点击左侧区域(返回图标),是否自动返回上一页
78
+ autoBack: {
79
+ type: Boolean,
80
+ default: false
81
+ },
82
+ // 标题的样式,对象或字符串
83
+ titleStyle: {
84
+ type: [String, Object],
85
+ default: ''
86
+ },
87
+ ...uni.$uv?.props?.navbar
88
+ }
89
+ }