@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,379 @@
1
+ <template>
2
+ <uv-transition
3
+ mode="fade"
4
+ :show="show"
5
+ :cell-child="cellChild"
6
+ >
7
+ <view class="uv-tags-wrapper">
8
+ <view
9
+ class="uv-tags"
10
+ :class="[`uv-tags--${shape}`, !plain && `uv-tags--${type}`, plain && `uv-tags--${type}--plain`, `uv-tags--${size}`,`uv-tags--${size}--${closePlace}`, plain && plainFill && `uv-tags--${type}--plain--fill`]"
11
+ @tap.stop="clickHandler"
12
+ :style="[{
13
+ marginRight: closable&& closePlace=='right-top' ? '10px' : 0,
14
+ marginTop: closable && closePlace=='right-top' ? '10px' : 0,
15
+ }, style, $uv.addStyle(customStyle)]"
16
+ >
17
+ <slot name="icon">
18
+ <view
19
+ class="uv-tags__icon"
20
+ v-if="icon"
21
+ >
22
+ <image
23
+ v-if="$uv.test.image(icon)"
24
+ :src="icon"
25
+ :style="[imgStyle]"
26
+ ></image>
27
+ <uv-icon
28
+ v-else
29
+ :color="elIconColor"
30
+ :name="icon"
31
+ :size="iconSize"
32
+ ></uv-icon>
33
+ </view>
34
+ </slot>
35
+ <text
36
+ class="uv-tags__text"
37
+ :style="[textColor, textStyle]"
38
+ :class="[`uv-tags__text--${type}`, plain && `uv-tags__text--${type}--plain`, `uv-tags__text--${size}`]"
39
+ >{{ text }}</text>
40
+ <view
41
+ class="uv-tags__close"
42
+ :class="[`uv-tags__close--${size}`,`uv-tags__close--${closePlace}`]"
43
+ v-if="closable && closePlace=='right'"
44
+ @tap.stop="closeHandler"
45
+ :style="{backgroundColor: closeColor}"
46
+ >
47
+ <uv-icon
48
+ name="close"
49
+ :size="closeSize"
50
+ color="#ffffff"
51
+ ></uv-icon>
52
+ </view>
53
+ </view>
54
+ <view
55
+ class="uv-tags__close"
56
+ :class="[`uv-tags__close--${size}`,`uv-tags__close--${closePlace}`]"
57
+ v-if="closable && closePlace=='right-top'"
58
+ @tap.stop="closeHandler"
59
+ :style="{backgroundColor: closeColor}"
60
+ >
61
+ <uv-icon
62
+ name="close"
63
+ :size="closeSize"
64
+ color="#ffffff"
65
+ ></uv-icon>
66
+ </view>
67
+ </view>
68
+ </uv-transition>
69
+ </template>
70
+
71
+ <script>
72
+ import { image } from '../../libs/function/test.js'
73
+ import mpMixin from '../../libs/mixin/mpMixin.js'
74
+ import mixin from '../../libs/mixin/mixin.js'
75
+ import props from './props.js';
76
+ /**
77
+ * Tag 标签
78
+ * @description tag组件一般用于标记和选择,我们提供了更加丰富的表现形式,能够较全面的涵盖您的使用场景
79
+ * @tutorial https://www.uvui.cn/components/tag.html
80
+ * @property {String} type 标签类型info、primary、success、warning、error (默认 'primary' )
81
+ * @property {Boolean | String} disabled 不可用(默认 false )
82
+ * @property {String} size 标签的大小,large,medium,mini (默认 'medium' )
83
+ * @property {String} shape tag的形状,circle(两边半圆形), square(方形,带圆角)(默认 'square' )
84
+ * @property {String | Number} text 标签的文字内容
85
+ * @property {String} bgColor 背景颜色,默认为空字符串,即不处理
86
+ * @property {String} color 标签字体颜色,默认为空字符串,即不处理
87
+ * @property {String} borderColor 镂空形式标签的边框颜色
88
+ * @property {String} closeColor 关闭按钮图标的颜色(默认 #C6C7CB)
89
+ * @property {String | Number} name 点击时返回的索引值,用于区分例遍的数组哪个元素被点击了
90
+ * @property {Boolean} plainFill 镂空时是否填充背景色(默认 false )
91
+ * @property {Boolean} plain 是否镂空(默认 false )
92
+ * @property {Boolean} closable 是否可关闭,设置为true,文字右边会出现一个关闭图标(默认 false )
93
+ * @property {Boolean} show 标签显示与否(默认 true )
94
+ * @property {String} icon 内置图标,或绝对路径的图片
95
+ * @event {Function(index)} click 点击标签时触发 index: 传递的index参数值
96
+ * @event {Function(index)} close closable为true时,点击标签关闭按钮触发 index: 传递的index参数值
97
+ * @example <uv-tags text="标签" type="error" plain plainFill></uv-tags>
98
+ */
99
+ export default {
100
+ name: 'uv-tags',
101
+ emits: ['click','close'],
102
+ mixins: [mpMixin, mixin, props],
103
+ computed: {
104
+ style() {
105
+ const style = {}
106
+ if (this.bgColor) {
107
+ style.backgroundColor = this.bgColor
108
+ }
109
+ if (this.color) {
110
+ style.color = this.color
111
+ }
112
+ if(this.borderColor) {
113
+ style.borderColor = this.borderColor
114
+ }
115
+ return style
116
+ },
117
+ // nvue下,文本颜色无法继承父元素
118
+ textColor() {
119
+ const style = {}
120
+ if (this.color) {
121
+ style.color = this.color
122
+ }
123
+ return style
124
+ },
125
+ imgStyle() {
126
+ const width = this.size === 'large' ? '17px' : this.size === 'medium' ? '15px' : '13px'
127
+ return {
128
+ width,
129
+ height: width
130
+ }
131
+ },
132
+ // 文本的样式
133
+ closeSize() {
134
+ const size = this.size === 'large' ? 15 : this.size === 'medium' ? 13 : 12
135
+ return size
136
+ },
137
+ // 图标大小
138
+ iconSize() {
139
+ const size = this.size === 'large' ? 21 : this.size === 'medium' ? 19 : 16
140
+ return size
141
+ },
142
+ // 图标颜色
143
+ elIconColor() {
144
+ return this.iconColor ? this.iconColor : this.plain ? this.type : '#ffffff'
145
+ }
146
+ },
147
+ methods: {
148
+ // 点击关闭按钮
149
+ closeHandler() {
150
+ this.$emit('close', this.name)
151
+ },
152
+ // 点击标签
153
+ clickHandler() {
154
+ this.$emit('click', this.name)
155
+ }
156
+ }
157
+ }
158
+ </script>
159
+
160
+ <style lang="scss" scoped >
161
+ @import '../../libs/css/components.scss';
162
+ @import '../../libs/css/color.scss';
163
+ .uv-tags-wrapper {
164
+ position: relative;
165
+ }
166
+
167
+ .uv-tags {
168
+ @include flex;
169
+ align-items: center;
170
+ border-style: solid;
171
+
172
+ &--circle {
173
+ border-radius: 100px;
174
+ }
175
+
176
+ &--square {
177
+ border-radius: 3px;
178
+ }
179
+
180
+ &__icon {
181
+ margin-right: 4px;
182
+ }
183
+
184
+ &__text {
185
+ &--mini {
186
+ font-size: 12px;
187
+ line-height: 12px;
188
+ }
189
+
190
+ &--medium {
191
+ font-size: 13px;
192
+ line-height: 13px;
193
+ }
194
+
195
+ &--large {
196
+ font-size: 15px;
197
+ line-height: 15px;
198
+ }
199
+ }
200
+
201
+ &--mini {
202
+ height: 22px;
203
+ line-height: 22px;
204
+ padding: 0 5px;
205
+ &--right {
206
+ padding-right: 2px;
207
+ }
208
+ }
209
+
210
+ &--medium {
211
+ height: 26px;
212
+ line-height: 22px;
213
+ padding: 0 10px;
214
+ &--right {
215
+ padding: 0 4px 0 8px;
216
+ }
217
+ }
218
+
219
+ &--large {
220
+ height: 32px;
221
+ line-height: 32px;
222
+ padding: 0 15px;
223
+ &--right {
224
+ padding: 0 4px 0 8px;
225
+ }
226
+ }
227
+
228
+ &--primary {
229
+ background-color: $uv-primary;
230
+ border-width: 1px;
231
+ border-color: $uv-primary;
232
+ }
233
+
234
+ &--primary--plain {
235
+ border-width: 1px;
236
+ border-color: $uv-primary;
237
+ }
238
+
239
+ &--primary--plain--fill {
240
+ background-color: #ecf5ff;
241
+ }
242
+
243
+ &__text--primary {
244
+ color: #FFFFFF;
245
+ }
246
+
247
+ &__text--primary--plain {
248
+ color: $uv-primary;
249
+ }
250
+
251
+ &--error {
252
+ background-color: $uv-error;
253
+ border-width: 1px;
254
+ border-color: $uv-error;
255
+ }
256
+
257
+ &--error--plain {
258
+ border-width: 1px;
259
+ border-color: $uv-error;
260
+ }
261
+
262
+ &--error--plain--fill {
263
+ background-color: #fef0f0;
264
+ }
265
+
266
+ &__text--error {
267
+ color: #FFFFFF;
268
+ }
269
+
270
+ &__text--error--plain {
271
+ color: $uv-error;
272
+ }
273
+
274
+ &--warning {
275
+ background-color: $uv-warning;
276
+ border-width: 1px;
277
+ border-color: $uv-warning;
278
+ }
279
+
280
+ &--warning--plain {
281
+ border-width: 1px;
282
+ border-color: $uv-warning;
283
+ }
284
+
285
+ &--warning--plain--fill {
286
+ background-color: #fdf6ec;
287
+ }
288
+
289
+ &__text--warning {
290
+ color: #FFFFFF;
291
+ }
292
+
293
+ &__text--warning--plain {
294
+ color: $uv-warning;
295
+ }
296
+
297
+ &--success {
298
+ background-color: $uv-success;
299
+ border-width: 1px;
300
+ border-color: $uv-success;
301
+ }
302
+
303
+ &--success--plain {
304
+ border-width: 1px;
305
+ border-color: $uv-success;
306
+ }
307
+
308
+ &--success--plain--fill {
309
+ background-color: #f5fff0;
310
+ }
311
+
312
+ &__text--success {
313
+ color: #FFFFFF;
314
+ }
315
+
316
+ &__text--success--plain {
317
+ color: $uv-success;
318
+ }
319
+
320
+ &--info {
321
+ background-color: $uv-info;
322
+ border-width: 1px;
323
+ border-color: $uv-info;
324
+ }
325
+
326
+ &--info--plain {
327
+ border-width: 1px;
328
+ border-color: $uv-info;
329
+ }
330
+
331
+ &--info--plain--fill {
332
+ background-color: #f4f4f5;
333
+ }
334
+
335
+ &__text--info {
336
+ color: #FFFFFF;
337
+ }
338
+
339
+ &__text--info--plain {
340
+ color: $uv-info;
341
+ }
342
+
343
+ &__close {
344
+ border-radius: 100px;
345
+ background-color: #C6C7CB;
346
+ @include flex(row);
347
+ align-items: center;
348
+ justify-content: center;
349
+ transform: scale(0.6);
350
+ &--right-top {
351
+ position: absolute;
352
+ z-index: 1;
353
+ top: 10px;
354
+ right: 10px;
355
+ /* #ifndef APP-NVUE */
356
+ transform: scale(0.6) translate(80%,-80%);
357
+ /* #endif */
358
+ /* #ifdef APP-NVUE */
359
+ transform: scale(0.6) translate(50%, -50%);
360
+ /* #endif */
361
+ }
362
+ &--mini {
363
+ width: 18px;
364
+ height: 18px;
365
+ }
366
+
367
+ &--medium {
368
+ width: 22px;
369
+ height: 22px;
370
+ }
371
+
372
+ &--large {
373
+ width: 25px;
374
+ height: 25px;
375
+ }
376
+ }
377
+
378
+ }
379
+ </style>
@@ -0,0 +1,113 @@
1
+ export default {
2
+ props: {
3
+ // 主题颜色
4
+ type: {
5
+ type: String,
6
+ default: ''
7
+ },
8
+ // 是否显示
9
+ show: {
10
+ type: Boolean,
11
+ default: true
12
+ },
13
+ // 显示的值
14
+ text: {
15
+ type: [String, Number],
16
+ default: ''
17
+ },
18
+ // 前置图标
19
+ prefixIcon: {
20
+ type: String,
21
+ default: ''
22
+ },
23
+ // 后置图标
24
+ suffixIcon: {
25
+ type: String,
26
+ default: ''
27
+ },
28
+ // 文本处理的匹配模式
29
+ // text-普通文本,price-价格,phone-手机号,name-姓名,date-日期,link-超链接
30
+ mode: {
31
+ type: String,
32
+ default: ''
33
+ },
34
+ // mode=link下,配置的链接
35
+ href: {
36
+ type: String,
37
+ default: ''
38
+ },
39
+ // 格式化规则
40
+ format: {
41
+ type: [String, Function],
42
+ default: ''
43
+ },
44
+ // mode=phone时,点击文本是否拨打电话
45
+ call: {
46
+ type: Boolean,
47
+ default: true
48
+ },
49
+ // 小程序的打开方式
50
+ openType: {
51
+ type: String,
52
+ default: ''
53
+ },
54
+ // 是否粗体,默认normal
55
+ bold: {
56
+ type: Boolean,
57
+ default: false
58
+ },
59
+ // 是否块状
60
+ block: {
61
+ type: Boolean,
62
+ default: false
63
+ },
64
+ // 文本显示的行数,如果设置,超出此行数,将会显示省略号
65
+ lines: {
66
+ type: [String, Number],
67
+ default: ''
68
+ },
69
+ // 文本颜色
70
+ color: {
71
+ type: String,
72
+ default: '#303133'
73
+ },
74
+ // 字体大小
75
+ size: {
76
+ type: [String, Number],
77
+ default: 15
78
+ },
79
+ // 图标的样式
80
+ iconStyle: {
81
+ type: [Object, String],
82
+ default: () => ({
83
+ fontSize: '15px'
84
+ })
85
+ },
86
+ // 文字装饰,下划线,中划线等,可选值 none|underline|line-through
87
+ decoration: {
88
+ type: String,
89
+ default: 'none'
90
+ },
91
+ // 外边距,对象、字符串,数值形式均可
92
+ margin: {
93
+ type: [Object, String, Number],
94
+ default: 0
95
+ },
96
+ // 文本行高
97
+ lineHeight: {
98
+ type: [String, Number],
99
+ default: ''
100
+ },
101
+ // 文本对齐方式,可选值left|center|right
102
+ align: {
103
+ type: String,
104
+ default: 'left'
105
+ },
106
+ // 文字换行,可选值break-word|normal|anywhere
107
+ wordWrap: {
108
+ type: String,
109
+ default: 'normal'
110
+ },
111
+ ...uni.$uv?.props?.text
112
+ }
113
+ }
@@ -0,0 +1,218 @@
1
+ <template>
2
+ <view
3
+ class="uv-text"
4
+ :class="[]"
5
+ v-if="show"
6
+ :style="{
7
+ margin: margin,
8
+ justifyContent: align === 'left' ? 'flex-start' : align === 'center' ? 'center' : 'flex-end'
9
+ }"
10
+ @tap="clickHandler"
11
+ >
12
+ <text
13
+ :class="['uv-text__price', type && `uv-text__value--${type}`]"
14
+ v-if="mode === 'price'"
15
+ :style="[valueStyle]"
16
+ >¥</text
17
+ >
18
+ <view class="uv-text__prefix-icon" v-if="prefixIcon">
19
+ <uv-icon
20
+ :name="prefixIcon"
21
+ :customStyle="$uv.addStyle(iconStyle)"
22
+ ></uv-icon>
23
+ </view>
24
+ <uv-link
25
+ v-if="mode === 'link'"
26
+ :text="value"
27
+ :href="href"
28
+ underLine
29
+ ></uv-link>
30
+ <template v-else-if="openType && isMp">
31
+ <button
32
+ class="uv-reset-button uv-text__value"
33
+ :style="[valueStyle]"
34
+ :openType="openType"
35
+ @getuserinfo="onGetUserInfo"
36
+ @contact="onContact"
37
+ @getphonenumber="onGetPhoneNumber"
38
+ @error="onError"
39
+ @launchapp="onLaunchApp"
40
+ @opensetting="onOpenSetting"
41
+ :lang="lang"
42
+ :session-from="sessionFrom"
43
+ :send-message-title="sendMessageTitle"
44
+ :send-message-path="sendMessagePath"
45
+ :send-message-img="sendMessageImg"
46
+ :show-message-card="showMessageCard"
47
+ :app-parameter="appParameter"
48
+ >
49
+ {{ value }}
50
+ </button>
51
+ </template>
52
+ <text
53
+ v-else
54
+ class="uv-text__value"
55
+ :style="[valueStyle]"
56
+ :class="[
57
+ type && `uv-text__value--${type}`,
58
+ lines && `uv-line-${lines}`
59
+ ]"
60
+ >{{ value }}</text
61
+ >
62
+ <view class="uv-text__suffix-icon" v-if="suffixIcon">
63
+ <uv-icon
64
+ :name="suffixIcon"
65
+ :customStyle="$uv.addStyle(iconStyle)"
66
+ ></uv-icon>
67
+ </view>
68
+ </view>
69
+ </template>
70
+ <script>
71
+ import value from './value.js'
72
+ import mpMixin from '../../libs/mixin/mpMixin.js'
73
+ import mixin from '../../libs/mixin/mixin.js'
74
+ import button from '../../libs/mixin/button.js'
75
+ import openType from '../../libs/mixin/openType.js'
76
+ import props from './props.js'
77
+ /**
78
+ * Text 文本
79
+ * @description 此组件集成了文本类在项目中的常用功能,包括状态,拨打电话,格式化日期,*替换,超链接...等功能。 您大可不必在使用特殊文本时自己定义,text组件几乎涵盖您能使用的大部分场景。
80
+ * @tutorial https://www.uvui.cn/components/loading.html
81
+ * @property {String} type 主题颜色
82
+ * @property {Boolean} show 是否显示(默认 true )
83
+ * @property {String | Number} text 显示的值
84
+ * @property {String} prefixIcon 前置图标
85
+ * @property {String} suffixIcon 后置图标
86
+ * @property {String} mode 文本处理的匹配模式 text-普通文本,price-价格,phone-手机号,name-姓名,date-日期,link-超链接
87
+ * @property {String} href mode=link下,配置的链接
88
+ * @property {String | Function} format 格式化规则
89
+ * @property {Boolean} call mode=phone时,点击文本是否拨打电话(默认 false )
90
+ * @property {String} openType 小程序的打开方式
91
+ * @property {Boolean} bold 是否粗体,默认normal(默认 false )
92
+ * @property {Boolean} block 是否块状(默认 false )
93
+ * @property {String | Number} lines 文本显示的行数,如果设置,超出此行数,将会显示省略号
94
+ * @property {String} color 文本颜色(默认 '#303133' )
95
+ * @property {String | Number} size 字体大小(默认 15 )
96
+ * @property {Object | String} iconStyle 图标的样式 (默认 {fontSize: '15px'} )
97
+ * @property {String} decoration 文字装饰,下划线,中划线等,可选值 none|underline|line-through(默认 'none' )
98
+ * @property {Object | String | Number} margin 外边距,对象、字符串,数值形式均可(默认 0 )
99
+ * @property {String | Number} lineHeight 文本行高
100
+ * @property {String} align 文本对齐方式,可选值left|center|right(默认 'left' )
101
+ * @property {String} wordWrap 文字换行,可选值break-word|normal|anywhere(默认 'normal' )
102
+ * @event {Function} click 点击触发事件
103
+ * @example <uv-text text="我用十年青春,赴你最后之约"></uv-text>
104
+ */
105
+ export default {
106
+ name: 'uv-text',
107
+ emits: ['click'],
108
+ // #ifdef MP
109
+ mixins: [mpMixin, mixin, value, button, openType, props],
110
+ // #endif
111
+ // #ifndef MP
112
+ mixins: [mpMixin, mixin, value, props],
113
+ // #endif
114
+ computed: {
115
+ valueStyle() {
116
+ const style = {
117
+ textDecoration: this.decoration,
118
+ fontWeight: this.bold ? 'bold' : 'normal',
119
+ wordWrap: this.wordWrap,
120
+ fontSize: this.$uv.addUnit(this.size)
121
+ };
122
+ !this.type && (style.color = this.color);
123
+ this.isNvue && this.lines && (style.lines = this.lines);
124
+ if(this.isNvue && this.mode != 'price' && !this.prefixIcon && !this.suffixIcon) {
125
+ style.flex = 1;
126
+ style.textAlign = this.align === 'left' ? 'flex-start' : this.align === 'center' ? 'center' : 'right';
127
+ }
128
+ this.lineHeight && (style.lineHeight = this.$uv.addUnit(this.lineHeight));
129
+ !this.isNvue && this.block && (style.display = 'block');
130
+ return this.$uv.deepMerge(style, this.$uv.addStyle(this.customStyle));
131
+ },
132
+ isNvue() {
133
+ let nvue = false
134
+ // #ifdef APP-NVUE
135
+ nvue = true
136
+ // #endif
137
+ return nvue
138
+ },
139
+ isMp() {
140
+ let mp = false
141
+ // #ifdef MP
142
+ mp = true
143
+ // #endif
144
+ return mp
145
+ }
146
+ },
147
+ data() {
148
+ return {}
149
+ },
150
+ methods: {
151
+ clickHandler() {
152
+ // 如果为手机号模式,拨打电话
153
+ if (this.call && this.mode === 'phone') {
154
+ uni.makePhoneCall({
155
+ phoneNumber: this.text
156
+ })
157
+ }
158
+ this.$emit('click')
159
+ }
160
+ }
161
+ }
162
+ </script>
163
+ <style lang="scss" scoped>
164
+ $show-lines: 1;
165
+ $show-reset-button: 1;
166
+ @import '../../libs/css/variable.scss';
167
+ @import '../../libs/css/components.scss';
168
+ @import '../../libs/css/color.scss';
169
+ .uv-text {
170
+ @include flex(row);
171
+ align-items: center;
172
+ flex-wrap: nowrap;
173
+ flex: 1;
174
+ /* #ifndef APP-NVUE */
175
+ width: 100%;
176
+ /* #endif */
177
+ &__price {
178
+ font-size: 14px;
179
+ color: $uv-content-color;
180
+ }
181
+ &__value {
182
+ font-size: 14px;
183
+ @include flex;
184
+ color: $uv-content-color;
185
+ flex-wrap: wrap;
186
+ // flex: 1;
187
+ text-overflow: ellipsis;
188
+ align-items: center;
189
+ &--primary {
190
+ color: $uv-primary;
191
+ }
192
+ &--warning {
193
+ color: $uv-warning;
194
+ }
195
+ &--success {
196
+ color: $uv-success;
197
+ }
198
+ &--info {
199
+ color: $uv-info;
200
+ }
201
+ &--error {
202
+ color: $uv-error;
203
+ }
204
+ &--main {
205
+ color: $uv-main-color;
206
+ }
207
+ &--content {
208
+ color: $uv-content-color;
209
+ }
210
+ &--tips {
211
+ color: $uv-tips-color;
212
+ }
213
+ &--light {
214
+ color: $uv-light-color;
215
+ }
216
+ }
217
+ }
218
+ </style>