@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,292 @@
1
+ <template>
2
+ <view class="uv-toast">
3
+ <uv-overlay
4
+ :show="isShow"
5
+ :custom-style="overlayStyle"
6
+ >
7
+ <view
8
+ class="uv-toast__content"
9
+ :style="[contentStyle]"
10
+ :class="['uv-type-' + tmpConfig.type, (tmpConfig.type === 'loading' || tmpConfig.loading) ? 'uv-toast__content--loading' : '']"
11
+ >
12
+ <uv-loading-icon
13
+ v-if="tmpConfig.type === 'loading'"
14
+ mode="circle"
15
+ color="rgb(255, 255, 255)"
16
+ inactiveColor="rgb(120, 120, 120)"
17
+ size="25"
18
+ ></uv-loading-icon>
19
+ <uv-icon
20
+ v-else-if="tmpConfig.type !== 'defalut' && iconName"
21
+ :name="iconName"
22
+ size="17"
23
+ :color="tmpConfig.type"
24
+ :customStyle="iconStyle"
25
+ ></uv-icon>
26
+ <uv-gap
27
+ v-if="tmpConfig.type === 'loading' || tmpConfig.loading"
28
+ height="12"
29
+ bgColor="transparent"
30
+ ></uv-gap>
31
+ <text
32
+ class="uv-toast__content__text"
33
+ :class="['uv-toast__content__text--' + tmpConfig.type]"
34
+ style="max-width: 400rpx;"
35
+ >{{ tmpConfig.message }}</text>
36
+ </view>
37
+ </uv-overlay>
38
+ </view>
39
+ </template>
40
+
41
+ <script>
42
+ import { hexToRgb } from '../../libs/function/colorGradient.js'
43
+ import mpMixin from '../../libs/mixin/mpMixin.js'
44
+ import mixin from '../../libs/mixin/mixin.js'
45
+ /**
46
+ * toast 消息提示
47
+ * @description 此组件表现形式类似uni的uni.showToastAPI,但也有不同的地方。
48
+ * @tutorial https://www.uvui.cn/components/toast.html
49
+ * @property {String | Number} zIndex toast展示时的zIndex值 (默认 10090 )
50
+ * @property {Boolean} loading 是否加载中 (默认 false )
51
+ * @property {String | Number} message 显示的文字内容
52
+ * @property {String} icon 图标,或者绝对路径的图片
53
+ * @property {String} type 主题类型 (默认 default)
54
+ * @property {Boolean} show 是否显示该组件 (默认 false)
55
+ * @property {Boolean} overlay 是否显示透明遮罩,防止点击穿透 (默认 false )
56
+ * @property {String} position 位置 (默认 'center' )
57
+ * @property {Object} params 跳转的参数
58
+ * @property {String | Number} duration 展示时间,单位ms (默认 2000 )
59
+ * @property {Boolean} isTab 是否返回的为tab页面 (默认 false )
60
+ * @property {String} url toast消失后是否跳转页面,有则跳转,优先级高于back参数
61
+ * @property {Function} complete 执行完后的回调函数
62
+ * @property {Boolean} back 结束toast是否自动返回上一页 (默认 false )
63
+ * @property {Object} customStyle 组件的样式,对象形式
64
+ * @event {Function} show 显示toast,如需一进入页面就显示toast,请在onReady生命周期调用
65
+ * @example <uv-toast ref="uToast" />
66
+ */
67
+ export default {
68
+ name: 'uv-toast',
69
+ mixins: [mpMixin, mixin],
70
+ data() {
71
+ return {
72
+ isShow: false,
73
+ timer: null, // 定时器
74
+ config: {
75
+ message: '', // 显示文本
76
+ type: '', // 主题类型,primary,success,error,warning,black
77
+ duration: 2000, // 显示的时间,毫秒
78
+ icon: true, // 显示的图标
79
+ position: 'center', // toast出现的位置
80
+ complete: null, // 执行完后的回调函数
81
+ overlay: false, // 是否防止触摸穿透
82
+ loading: false, // 是否加载中状态
83
+ },
84
+ tmpConfig: {}, // 将用户配置和内置配置合并后的临时配置变量
85
+ }
86
+ },
87
+ computed: {
88
+ iconName() {
89
+ // 只有不为none,并且type为error|warning|succes|info时候,才显示图标
90
+ if(!this.tmpConfig.icon || this.tmpConfig.icon == 'none') {
91
+ return '';
92
+ }
93
+ if (['error', 'warning', 'success', 'primary'].includes(this.tmpConfig.type)) {
94
+ return this.$uv.type2icon(this.tmpConfig.type)
95
+ } else {
96
+ return ''
97
+ }
98
+ },
99
+ overlayStyle() {
100
+ const style = {
101
+ justifyContent: 'center',
102
+ alignItems: 'center',
103
+ display: 'flex'
104
+ }
105
+ // 将遮罩设置为100%透明度,避免出现灰色背景
106
+ style.backgroundColor = 'rgba(0, 0, 0, 0)'
107
+ return style
108
+ },
109
+ iconStyle() {
110
+ const style = {}
111
+ // 图标需要一个右边距,以跟右边的文字有隔开的距离
112
+ style.marginRight = '4px'
113
+ // #ifdef APP-NVUE
114
+ // iOSAPP下,图标有1px的向下偏移,这里进行修正
115
+ if (this.$uv.os() === 'ios') {
116
+ style.marginTop = '-1px'
117
+ }
118
+ // #endif
119
+ return style
120
+ },
121
+ // 内容盒子的样式
122
+ contentStyle() {
123
+ const windowHeight = this.$uv.sys().windowHeight, style = {}
124
+ let value = 0
125
+ // 根据top和bottom,对Y轴进行窗体高度的百分比偏移
126
+ if(this.tmpConfig.position === 'top') {
127
+ value = - windowHeight * 0.25
128
+ } else if(this.tmpConfig.position === 'bottom') {
129
+ value = windowHeight * 0.25
130
+ }
131
+ style.transform = `translateY(${value}px)`
132
+ return style
133
+ }
134
+ },
135
+ created() {
136
+ // 通过主题的形式调用toast,批量生成方法函数
137
+ ['primary', 'success', 'error', 'warning', 'default', 'loading'].map(item => {
138
+ this[item] = message => this.show({
139
+ type: item,
140
+ message
141
+ })
142
+ })
143
+ },
144
+ methods: {
145
+ // 显示toast组件,由父组件通过this.$refs.xxx.show(options)形式调用
146
+ show(options) {
147
+ // 不将结果合并到this.config变量,避免多次调用uv-toast,前后的配置造成混乱
148
+ this.tmpConfig = this.$uv.deepMerge(this.config, options)
149
+ // 清除定时器
150
+ this.clearTimer()
151
+ this.isShow = true
152
+ this.timer = setTimeout(() => {
153
+ // 倒计时结束,清除定时器,隐藏toast组件
154
+ this.clearTimer()
155
+ // 判断是否存在callback方法,如果存在就执行
156
+ typeof(this.tmpConfig.complete) === 'function' && this.tmpConfig.complete()
157
+ }, this.tmpConfig.duration)
158
+ },
159
+ // 隐藏toast组件,由父组件通过this.$refs.xxx.hide()形式调用
160
+ hide() {
161
+ this.clearTimer()
162
+ },
163
+ clearTimer() {
164
+ this.isShow = false
165
+ // 清除定时器
166
+ clearTimeout(this.timer)
167
+ this.timer = null
168
+ }
169
+ },
170
+ // #ifdef VUE2
171
+ beforeDestroy() {
172
+ this.clearTimer()
173
+ },
174
+ // #endif
175
+ // #ifdef VUE3
176
+ unmounted() {
177
+ this.clearTimer()
178
+ }
179
+ // #endif
180
+ }
181
+ </script>
182
+
183
+ <style lang="scss" scoped>
184
+ @import '../../libs/css/components.scss';
185
+ @import '../../libs/css/color.scss';
186
+ $uv-toast-color:#fff !default;
187
+ $uv-toast-border-radius:4px !default;
188
+ $uv-toast-border-background-color:#585858 !default;
189
+ $uv-toast-border-font-size:14px !default;
190
+ $uv-toast-border-padding:12px 20px !default;
191
+ $uv-toast-loading-border-padding: 20px 20px !default;
192
+ $uv-toast-content-text-color:#fff !default;
193
+ $uv-toast-content-text-font-size:15px !default;
194
+ $uv-toast-uv-icon:10rpx !default;
195
+ $uv-toast-uv-type-primary-color:$uv-primary !default;
196
+ $uv-toast-uv-type-primary-background-color:#ecf5ff !default;
197
+ $uv-toast-uv-type-primary-border-color:rgb(215, 234, 254) !default;
198
+ $uv-toast-uv-type-primary-border-width:1px !default;
199
+ $uv-toast-uv-type-success-color: $uv-success !default;
200
+ $uv-toast-uv-type-success-background-color: #dbf1e1 !default;
201
+ $uv-toast-uv-type-success-border-color: #BEF5C8 !default;
202
+ $uv-toast-uv-type-success-border-width: 1px !default;
203
+ $uv-toast-uv-type-error-color:$uv-error !default;
204
+ $uv-toast-uv-type-error-background-color:#fef0f0 !default;
205
+ $uv-toast-uv-type-error-border-color:#fde2e2 !default;
206
+ $uv-toast-uv-type-error-border-width: 1px !default;
207
+ $uv-toast-uv-type-warning-color:$uv-warning !default;
208
+ $uv-toast-uv-type-warning-background-color:#fdf6ec !default;
209
+ $uv-toast-uv-type-warning-border-color:#faecd8 !default;
210
+ $uv-toast-uv-type-warning-border-width: 1px !default;
211
+ $uv-toast-uv-type-default-color:#fff !default;
212
+ $uv-toast-uv-type-default-background-color:#585858 !default;
213
+
214
+ .uv-toast {
215
+ &__content {
216
+ @include flex;
217
+ padding: $uv-toast-border-padding;
218
+ border-radius: $uv-toast-border-radius;
219
+ background-color: $uv-toast-border-background-color;
220
+ color: $uv-toast-color;
221
+ align-items: center;
222
+ /* #ifndef APP-NVUE */
223
+ max-width: 600rpx;
224
+ /* #endif */
225
+ position: relative;
226
+
227
+ &--loading {
228
+ flex-direction: column;
229
+ padding: $uv-toast-loading-border-padding;
230
+ }
231
+
232
+ &__text {
233
+ color: $uv-toast-content-text-color;
234
+ font-size: $uv-toast-content-text-font-size;
235
+ line-height: $uv-toast-content-text-font-size;
236
+
237
+ &--default {
238
+ color: $uv-toast-content-text-color;
239
+ }
240
+
241
+ &--error {
242
+ color: $uv-error;
243
+ }
244
+
245
+ &--primary {
246
+ color: $uv-primary;
247
+ }
248
+
249
+ &--success {
250
+ color: $uv-success;
251
+ }
252
+
253
+ &--warning {
254
+ color: $uv-warning;
255
+ }
256
+ }
257
+ }
258
+ }
259
+
260
+ .uv-type-primary {
261
+ color: $uv-toast-uv-type-primary-color;
262
+ background-color: $uv-toast-uv-type-primary-background-color;
263
+ border-color: $uv-toast-uv-type-primary-border-color;
264
+ border-width: $uv-toast-uv-type-primary-border-width;
265
+ }
266
+
267
+ .uv-type-success {
268
+ color: $uv-toast-uv-type-success-color;
269
+ background-color: $uv-toast-uv-type-success-background-color;
270
+ border-color: $uv-toast-uv-type-success-border-color;
271
+ border-width: 1px;
272
+ }
273
+
274
+ .uv-type-error {
275
+ color: $uv-toast-uv-type-error-color;
276
+ background-color: $uv-toast-uv-type-error-background-color;
277
+ border-color: $uv-toast-uv-type-error-border-color;
278
+ border-width: $uv-toast-uv-type-error-border-width;
279
+ }
280
+
281
+ .uv-type-warning {
282
+ color: $uv-toast-uv-type-warning-color;
283
+ background-color: $uv-toast-uv-type-warning-background-color;
284
+ border-color: $uv-toast-uv-type-warning-border-color;
285
+ border-width: 1px;
286
+ }
287
+
288
+ .uv-type-default {
289
+ color: $uv-toast-uv-type-default-color;
290
+ background-color: $uv-toast-uv-type-default-background-color;
291
+ }
292
+ </style>
@@ -0,0 +1,40 @@
1
+ export default {
2
+ props: {
3
+ // 是否展示工具条
4
+ show: {
5
+ type: Boolean,
6
+ default: true
7
+ },
8
+ // 是否显示下边框
9
+ showBorder: {
10
+ type: Boolean,
11
+ default: false
12
+ },
13
+ // 取消按钮的文字
14
+ cancelText: {
15
+ type: String,
16
+ default: '取消'
17
+ },
18
+ // 确认按钮的文字
19
+ confirmText: {
20
+ type: String,
21
+ default: '确认'
22
+ },
23
+ // 取消按钮的颜色
24
+ cancelColor: {
25
+ type: String,
26
+ default: '#909193'
27
+ },
28
+ // 确认按钮的颜色
29
+ confirmColor: {
30
+ type: String,
31
+ default: '#3c9cff'
32
+ },
33
+ // 标题文字
34
+ title: {
35
+ type: String,
36
+ default: ''
37
+ },
38
+ ...uni.$uv?.props?.toolbar
39
+ }
40
+ }
@@ -0,0 +1,109 @@
1
+ <template>
2
+ <view
3
+ :class="['uv-toolbar',{'uv-border-bottom':showBorder}]"
4
+ @touchmove.stop.prevent="noop"
5
+ v-if="show"
6
+ >
7
+ <view
8
+ class="uv-toolbar__cancel__wrapper"
9
+ hover-class="uv-hover-class"
10
+ >
11
+ <text
12
+ class="uv-toolbar__wrapper__cancel"
13
+ @tap="cancel"
14
+ :style="{
15
+ color: cancelColor
16
+ }"
17
+ >{{ cancelText }}</text>
18
+ </view>
19
+ <text
20
+ class="uv-toolbar__title uv-line-1"
21
+ v-if="title"
22
+ >{{ title }}</text>
23
+ <view
24
+ class="uv-toolbar__confirm__wrapper"
25
+ hover-class="uv-hover-class"
26
+ >
27
+ <text
28
+ class="uv-toolbar__wrapper__confirm"
29
+ @tap="confirm"
30
+ :style="{
31
+ color: confirmColor
32
+ }"
33
+ >{{ confirmText }}</text>
34
+ </view>
35
+ </view>
36
+ </template>
37
+ <script>
38
+ import mpMixin from '../../libs/mixin/mpMixin.js'
39
+ import mixin from '../../libs/mixin/mixin.js'
40
+ import props from './props.js';
41
+ /**
42
+ * Toolbar 工具条
43
+ * @description
44
+ * @tutorial https://www.uvui.cn/components/toolbar.html
45
+ * @property {Boolean} show 是否展示工具条(默认 true )
46
+ * @property {Boolean} showBorder 是否展示工具条下方边框(默认 false )
47
+ * @property {String} cancelText 取消按钮的文字(默认 '取消' )
48
+ * @property {String} confirmText 确认按钮的文字(默认 '确认' )
49
+ * @property {String} cancelColor 取消按钮的颜色(默认 '#909193' )
50
+ * @property {String} confirmColor 确认按钮的颜色(默认 '#3c9cff' )
51
+ * @property {String} title 标题文字
52
+ * @event {Function}
53
+ * @example
54
+ */
55
+ export default {
56
+ name: 'uv-toolbar',
57
+ emits: ['confirm', 'cancel'],
58
+ mixins: [mpMixin, mixin, props],
59
+ methods: {
60
+ // 点击取消按钮
61
+ cancel() {
62
+ this.$emit('cancel')
63
+ },
64
+ // 点击确定按钮
65
+ confirm() {
66
+ this.$emit('confirm')
67
+ }
68
+ }
69
+ }
70
+ </script>
71
+
72
+ <style lang="scss" scoped>
73
+ $show-lines: 1;
74
+ $show-hover: 1;
75
+ $show-border: 1;
76
+ $show-border-bottom: 1;
77
+ @import '../../libs/css/variable.scss';
78
+ @import '../../libs/css/components.scss';
79
+ $uv-tips-color: #909193 !default;
80
+ $uv-main-color: #303133 !default;
81
+ $uv-primary: #3c9cff !default;
82
+ .uv-toolbar {
83
+ height: 42px;
84
+ @include flex;
85
+ justify-content: space-between;
86
+ align-items: center;
87
+ &__wrapper {
88
+ &__cancel {
89
+ color: $uv-tips-color;
90
+ font-size: 15px;
91
+ padding: 0 15px;
92
+ }
93
+ }
94
+ &__title {
95
+ color: $uv-main-color;
96
+ padding: 0 60rpx;
97
+ font-size: 16px;
98
+ flex: 1;
99
+ text-align: center;
100
+ }
101
+ &__wrapper {
102
+ &__confirm {
103
+ color: $uv-primary;
104
+ font-size: 15px;
105
+ padding: 0 15px;
106
+ }
107
+ }
108
+ }
109
+ </style>
@@ -0,0 +1,60 @@
1
+ export default {
2
+ props: {
3
+ // 需要显示的提示文字
4
+ text: {
5
+ type: [String, Number],
6
+ default: ''
7
+ },
8
+ // 点击复制按钮时,复制的文本,为空则使用text值
9
+ copyText: {
10
+ type: [String, Number],
11
+ default: ''
12
+ },
13
+ // 文本大小
14
+ size: {
15
+ type: [String, Number],
16
+ default: 14
17
+ },
18
+ // 字体颜色
19
+ color: {
20
+ type: String,
21
+ default: '#606266'
22
+ },
23
+ // 弹出提示框时,文本的背景色
24
+ bgColor: {
25
+ type: String,
26
+ default: 'transparent'
27
+ },
28
+ // 弹出提示的方向,top-上方,bottom-下方
29
+ direction: {
30
+ type: String,
31
+ default: 'top'
32
+ },
33
+ // 弹出提示的z-index,nvue无效
34
+ zIndex: {
35
+ type: [String, Number],
36
+ default: 10071
37
+ },
38
+ // 是否显示复制按钮
39
+ showCopy: {
40
+ type: Boolean,
41
+ default: true
42
+ },
43
+ // 扩展的按钮组
44
+ buttons: {
45
+ type: Array,
46
+ default: () => []
47
+ },
48
+ // 是否显示透明遮罩以防止触摸穿透
49
+ overlay: {
50
+ type: Boolean,
51
+ default: true
52
+ },
53
+ // 是否显示复制成功或者失败的toast
54
+ showToast: {
55
+ type: Boolean,
56
+ default: true
57
+ },
58
+ ...uni.$uv?.props?.tooltip
59
+ }
60
+ }