@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,110 @@
1
+ <template>
2
+ <view
3
+ class="uv-notice-bar"
4
+ v-if="show"
5
+ :style="[{
6
+ backgroundColor: bgColor
7
+ }, $uv.addStyle(customStyle)]"
8
+ >
9
+ <template v-if="direction === 'column' || (direction === 'row' && step)">
10
+ <uv-column-notice
11
+ :color="color"
12
+ :bgColor="bgColor"
13
+ :text="text"
14
+ :mode="mode"
15
+ :step="step"
16
+ :icon="icon"
17
+ :disable-touch="disableTouch"
18
+ :disable-scroll="disableScroll"
19
+ :fontSize="fontSize"
20
+ :duration="duration"
21
+ @close="close"
22
+ @click="click"
23
+ @change="change"
24
+ ></uv-column-notice>
25
+ </template>
26
+ <template v-else>
27
+ <uv-row-notice
28
+ :color="color"
29
+ :bgColor="bgColor"
30
+ :text="text"
31
+ :mode="mode"
32
+ :fontSize="fontSize"
33
+ :speed="speed"
34
+ :url="url"
35
+ :linkType="linkType"
36
+ :icon="icon"
37
+ @close="close"
38
+ @click="click"
39
+ ></uv-row-notice>
40
+ </template>
41
+ </view>
42
+ </template>
43
+ <script>
44
+ import mpMixin from '../../libs/mixin/mpMixin.js'
45
+ import mixin from '../../libs/mixin/mixin.js'
46
+ import props from './props.js';
47
+
48
+ /**
49
+ * noticeBar 滚动通知
50
+ * @description 该组件用于滚动通告场景,有多种模式可供选择
51
+ * @tutorial https://www.uvui.cn/components/noticeBar.html
52
+ * @property {Array | String} text 显示的内容,数组
53
+ * @property {String} direction 通告滚动模式,row-横向滚动,column-竖向滚动 ( 默认 'row' )
54
+ * @property {Boolean} step direction = row时,是否使用步进形式滚动 ( 默认 false )
55
+ * @property {String} icon 是否显示左侧的音量图标 ( 默认 'volume' )
56
+ * @property {String} mode 通告模式,link-显示右箭头,closable-显示右侧关闭图标
57
+ * @property {String} color 文字颜色,各图标也会使用文字颜色 ( 默认 '#f9ae3d' )
58
+ * @property {String} bgColor 背景颜色 ( 默认 '#fdf6ec' )
59
+ * @property {String | Number} speed 水平滚动时的滚动速度,即每秒滚动多少px(px),这有利于控制文字无论多少时,都能有一个恒定的速度 ( 默认 80 )
60
+ * @property {String | Number} fontSize 字体大小 ( 默认 14 )
61
+ * @property {String | Number} duration 滚动一个周期的时间长,单位ms ( 默认 2000 )
62
+ * @property {Boolean} disableTouch 是否禁止用手滑动切换 目前HX2.6.11,只支持App 2.5.5+、H5 2.5.5+、支付宝小程序、字节跳动小程序(默认34) ( 默认 true )
63
+ * @property {String} url 跳转的页面路径
64
+ * @property {String} linkType 页面跳转的类型 ( 默认 navigateTo )
65
+ * @property {Object} customStyle 定义需要用到的外部样式
66
+ *
67
+ * @event {Function} click 点击通告文字触发
68
+ * @event {Function} close 点击右侧关闭图标触发
69
+ * @example <uv-notice-bar :more-icon="true" :list="list"></uv-notice-bar>
70
+ */
71
+ export default {
72
+ name: "uv-notice-bar",
73
+ emits: ['click','close','change'],
74
+ mixins: [mpMixin, mixin, props],
75
+ data() {
76
+ return {
77
+ show: true
78
+ }
79
+ },
80
+ methods: {
81
+ // 点击通告栏
82
+ click(index) {
83
+ this.$emit('click', index)
84
+ if (this.url && this.linkType) {
85
+ // 此方法写在mixin中,另外跳转的url和linkType参数也在mixin的props中
86
+ this.openPage()
87
+ }
88
+ },
89
+ // 点击关闭按钮
90
+ close() {
91
+ this.show = false
92
+ this.$emit('close')
93
+ },
94
+ // 竖向滚动时触发
95
+ change(index){
96
+ this.$emit('change',index)
97
+ }
98
+ }
99
+ };
100
+ </script>
101
+
102
+ <style lang="scss" scoped>
103
+ @import '../../libs/css/components.scss';
104
+
105
+ .uv-notice-bar {
106
+ overflow: hidden;
107
+ padding: 9px 12px;
108
+ flex: 1;
109
+ }
110
+ </style>
@@ -0,0 +1,45 @@
1
+ export default {
2
+ props: {
3
+ // 到顶部的距离
4
+ top: {
5
+ type: [String, Number],
6
+ default: 0
7
+ },
8
+ // type主题,primary,success,warning,error
9
+ type: {
10
+ type: String,
11
+ default: 'primary'
12
+ },
13
+ // 字体颜色
14
+ color: {
15
+ type: String,
16
+ default: '#ffffff'
17
+ },
18
+ // 背景颜色
19
+ bgColor: {
20
+ type: String,
21
+ default: ''
22
+ },
23
+ // 展示的文字内容
24
+ message: {
25
+ type: String,
26
+ default: ''
27
+ },
28
+ // 展示时长,为0时不消失,单位ms
29
+ duration: {
30
+ type: [String, Number],
31
+ default: 3000
32
+ },
33
+ // 字体大小
34
+ fontSize: {
35
+ type: [String, Number],
36
+ default: 15
37
+ },
38
+ // 是否留出顶部安全距离(状态栏高度)
39
+ safeAreaInsetTop: {
40
+ type: Boolean,
41
+ default: false
42
+ },
43
+ ...uni.$uv?.props?.notify
44
+ }
45
+ }
@@ -0,0 +1,220 @@
1
+ <template>
2
+ <uv-transition
3
+ mode="slide-top"
4
+ :customStyle="containerStyle"
5
+ :show="open"
6
+ >
7
+ <view
8
+ class="uv-notify"
9
+ :class="[`uv-notify--${tmpConfig.type}`]"
10
+ :style="[backgroundColor, $uv.addStyle(customStyle)]"
11
+ >
12
+ <uv-status-bar v-if="tmpConfig.safeAreaInsetTop"></uv-status-bar>
13
+ <view class="uv-notify__warpper">
14
+ <slot name="icon">
15
+ <uv-icon
16
+ v-if="['success', 'warning', 'error'].includes(tmpConfig.type)"
17
+ :name="tmpConfig.icon"
18
+ :color="tmpConfig.color"
19
+ :size="1.3 * tmpConfig.fontSize"
20
+ :customStyle="{marginRight: '4px'}"
21
+ ></uv-icon>
22
+ </slot>
23
+ <text
24
+ class="uv-notify__warpper__text"
25
+ :style="{
26
+ fontSize: $uv.addUnit(tmpConfig.fontSize),
27
+ color: tmpConfig.color
28
+ }"
29
+ >{{ tmpConfig.message }}</text>
30
+ </view>
31
+ </view>
32
+ </uv-transition>
33
+ </template>
34
+
35
+ <script>
36
+ import mpMixin from '../../libs/mixin/mpMixin.js'
37
+ import mixin from '../../libs/mixin/mixin.js'
38
+ import props from './props.js';
39
+ /**
40
+ * notify 顶部提示
41
+ * @description 该组件一般用于页面顶部向下滑出一个提示,尔后自动收起的场景
42
+ * @tutorial
43
+ * @property {String | Number} top 到顶部的距离 ( 默认 0 )
44
+ * @property {String} type 主题,primary,success,warning,error ( 默认 'primary' )
45
+ * @property {String} color 字体颜色 ( 默认 '#ffffff' )
46
+ * @property {String} bgColor 背景颜色
47
+ * @property {String} message 展示的文字内容
48
+ * @property {String | Number} duration 展示时长,为0时不消失,单位ms ( 默认 3000 )
49
+ * @property {String | Number} fontSize 字体大小 ( 默认 15 )
50
+ * @property {Boolean} safeAreaInsetTop 是否留出顶部安全距离(状态栏高度) ( 默认 false )
51
+ * @property {Object} customStyle 组件的样式,对象形式
52
+ * @event {Function} open 开启组件时调用的函数
53
+ * @event {Function} close 关闭组件式调用的函数
54
+ * @example <uv-notify message="Hi uvui"></uv-notify>
55
+ */
56
+ export default {
57
+ name: 'uv-notify',
58
+ mixins: [mpMixin, mixin, props],
59
+ data() {
60
+ return {
61
+ // 是否展示组件
62
+ open: false,
63
+ timer: null,
64
+ config: {
65
+ // 到顶部的距离
66
+ top: this.top,
67
+ // type主题,primary,success,warning,error
68
+ type: this.type,
69
+ // 字体颜色
70
+ color: this.color,
71
+ // 背景颜色
72
+ bgColor: this.bgColor,
73
+ // 展示的文字内容
74
+ message: this.message,
75
+ // 展示时长,为0时不消失,单位ms
76
+ duration: this.duration,
77
+ // 字体大小
78
+ fontSize: this.fontSize,
79
+ // 是否留出顶部安全距离(状态栏高度)
80
+ safeAreaInsetTop: this.safeAreaInsetTop
81
+ },
82
+ // 合并后的配置,避免多次调用组件后,可能会复用之前使用的配置参数
83
+ tmpConfig: {}
84
+ }
85
+ },
86
+ computed: {
87
+ containerStyle() {
88
+ let top = 0
89
+ if (this.tmpConfig.top === 0) {
90
+ // #ifdef H5
91
+ // H5端,导航栏为普通元素,需要将组件移动到导航栏的下边沿
92
+ // H5的导航栏高度为44px
93
+ top = 44
94
+ // #endif
95
+ }
96
+ const style = {
97
+ top: this.$uv.addUnit(this.tmpConfig.top === 0 ? top : this.tmpConfig.top),
98
+ // 因为组件底层为uv-transition组件,必须将其设置为fixed定位
99
+ // 让其出现在导航栏底部
100
+ position: 'fixed',
101
+ left: 0,
102
+ right: 0,
103
+ zIndex: 10076
104
+ }
105
+ return style
106
+ },
107
+ // 组件背景颜色
108
+ backgroundColor() {
109
+ const style = {}
110
+ if (this.tmpConfig.bgColor) {
111
+ style.backgroundColor = this.tmpConfig.bgColor
112
+ }
113
+ return style
114
+ },
115
+ // 默认主题下的图标
116
+ icon() {
117
+ let icon
118
+ if (this.tmpConfig.type === 'success') {
119
+ icon = 'checkmark-circle'
120
+ } else if (this.tmpConfig.type === 'error') {
121
+ icon = 'close-circle'
122
+ } else if (this.tmpConfig.type === 'warning') {
123
+ icon = 'error-circle'
124
+ }
125
+ return icon
126
+ }
127
+ },
128
+ created() {
129
+ // 通过主题的形式调用toast,批量生成方法函数
130
+ ['primary', 'success', 'error', 'warning'].map(item => {
131
+ this[item] = message => this.show({
132
+ type: item,
133
+ message
134
+ })
135
+ })
136
+ },
137
+ methods: {
138
+ show(options) {
139
+ // 不将结果合并到this.config变量,避免多次调用uv-toast,前后的配置造成混乱
140
+ this.tmpConfig = this.$uv.deepMerge(this.config, options)
141
+ // 任何定时器初始化之前,都要执行清除操作,否则可能会造成混乱
142
+ this.clearTimer()
143
+ this.open = true
144
+ if (this.tmpConfig.duration > 0) {
145
+ this.timer = setTimeout(() => {
146
+ this.open = false
147
+ // 倒计时结束,清除定时器,隐藏toast组件
148
+ this.clearTimer()
149
+ // 判断是否存在callback方法,如果存在就执行
150
+ typeof(this.tmpConfig.complete) === 'function' && this.tmpConfig.complete()
151
+ }, this.tmpConfig.duration)
152
+ }
153
+ },
154
+ // 关闭notify
155
+ close() {
156
+ this.clearTimer()
157
+ },
158
+ clearTimer() {
159
+ this.open = false
160
+ // 清除定时器
161
+ clearTimeout(this.timer)
162
+ this.timer = null
163
+ }
164
+ },
165
+ // #ifdef VUE2
166
+ beforeDestroy() {
167
+ this.clearTimer()
168
+ },
169
+ // #endif
170
+ // #ifdef VUE3
171
+ unmounted() {
172
+ this.clearTimer()
173
+ }
174
+ // #endif
175
+ }
176
+ </script>
177
+
178
+ <style lang="scss" scoped>
179
+ @import '../../libs/css/components.scss';
180
+ @import '../../libs/css/color.scss';
181
+ $uv-notify-padding: 8px 10px !default;
182
+ $uv-notify-text-font-size: 15px !default;
183
+ $uv-notify-primary-bgColor: $uv-primary !default;
184
+ $uv-notify-success-bgColor: $uv-success !default;
185
+ $uv-notify-error-bgColor: $uv-error !default;
186
+ $uv-notify-warning-bgColor: $uv-warning !default;
187
+
188
+
189
+ .uv-notify {
190
+ padding: $uv-notify-padding;
191
+
192
+ &__warpper {
193
+ @include flex;
194
+ align-items: center;
195
+ text-align: center;
196
+ justify-content: center;
197
+
198
+ &__text {
199
+ font-size: $uv-notify-text-font-size;
200
+ text-align: center;
201
+ }
202
+ }
203
+
204
+ &--primary {
205
+ background-color: $uv-notify-primary-bgColor;
206
+ }
207
+
208
+ &--success {
209
+ background-color: $uv-notify-success-bgColor;
210
+ }
211
+
212
+ &--error {
213
+ background-color: $uv-notify-error-bgColor;
214
+ }
215
+
216
+ &--warning {
217
+ background-color: $uv-notify-warning-bgColor;
218
+ }
219
+ }
220
+ </style>
@@ -0,0 +1,118 @@
1
+ export default {
2
+ props: {
3
+ value: {
4
+ type: [String, Number],
5
+ default: 0
6
+ },
7
+ modelValue: {
8
+ type: [String, Number],
9
+ default: 0
10
+ },
11
+ // 步进器标识符,在change回调返回
12
+ name: {
13
+ type: [String, Number],
14
+ default: ''
15
+ },
16
+ // 最小值
17
+ min: {
18
+ type: [String, Number],
19
+ default: 1
20
+ },
21
+ // 最大值
22
+ max: {
23
+ type: [String, Number],
24
+ default: Number.MAX_SAFE_INTEGER
25
+ },
26
+ // 加减的步长,可为小数
27
+ step: {
28
+ type: [String, Number],
29
+ default: 1
30
+ },
31
+ // 是否只允许输入整数
32
+ integer: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ // 是否禁用,包括输入框,加减按钮
37
+ disabled: {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ // 是否禁用输入框
42
+ disabledInput: {
43
+ type: Boolean,
44
+ default: false
45
+ },
46
+ // 是否开启异步变更,开启后需要手动控制输入值
47
+ asyncChange: {
48
+ type: Boolean,
49
+ default: false
50
+ },
51
+ // 输入框宽度,单位为px
52
+ inputWidth: {
53
+ type: [String, Number],
54
+ default: 35
55
+ },
56
+ // 是否显示减少按钮
57
+ showMinus: {
58
+ type: Boolean,
59
+ default: true
60
+ },
61
+ // 是否显示增加按钮
62
+ showPlus: {
63
+ type: Boolean,
64
+ default: true
65
+ },
66
+ // 显示的小数位数
67
+ decimalLength: {
68
+ type: [String, Number, null],
69
+ default: null
70
+ },
71
+ // 是否开启长按加减手势
72
+ longPress: {
73
+ type: Boolean,
74
+ default: true
75
+ },
76
+ // 输入框文字和加减按钮图标的颜色
77
+ color: {
78
+ type: String,
79
+ default: '#323233'
80
+ },
81
+ // 按钮大小,宽高等于此值,单位px,输入框高度和此值保持一致
82
+ buttonSize: {
83
+ type: [String, Number],
84
+ default: 30
85
+ },
86
+ // 输入框和按钮的背景颜色
87
+ bgColor: {
88
+ type: String,
89
+ default: '#EBECEE'
90
+ },
91
+ // 指定光标于键盘的距离,避免键盘遮挡输入框,单位px
92
+ cursorSpacing: {
93
+ type: [String, Number],
94
+ default: 100
95
+ },
96
+ // 是否禁用增加按钮
97
+ disablePlus: {
98
+ type: Boolean,
99
+ default: false
100
+ },
101
+ // 是否禁用减少按钮
102
+ disableMinus: {
103
+ type: Boolean,
104
+ default: false
105
+ },
106
+ // 键盘弹起时,是否自动上推页面
107
+ adjustPosition: {
108
+ type: Boolean,
109
+ default: true
110
+ },
111
+ // 加减按钮图标的样式
112
+ iconStyle: {
113
+ type: [Object, String],
114
+ default: ''
115
+ },
116
+ ...uni.$uv?.props?.numberBox
117
+ }
118
+ }