@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,529 @@
1
+ <template>
2
+ <view
3
+ class="uv-button-wrapper"
4
+ :style="[btnWrapperStyle]"
5
+ >
6
+ <!-- #ifndef APP-NVUE -->
7
+ <view class="uv-button-wrapper--dis" v-if="disabled || loading" @tap.stop="disabledHandler"></view>
8
+ <!-- #ifdef MP -->
9
+ <!-- 为了解决微信小程序动态设置hover-class点击态不消失的BUG -->
10
+ <button
11
+ :hover-start-time="Number(hoverStartTime)"
12
+ :hover-stay-time="Number(hoverStayTime)"
13
+ :form-type="formType"
14
+ :open-type="openType"
15
+ :app-parameter="appParameter"
16
+ :hover-stop-propagation="hoverStopPropagation"
17
+ :send-message-title="sendMessageTitle"
18
+ :send-message-path="sendMessagePath"
19
+ :lang="lang"
20
+ :data-name="dataName"
21
+ :session-from="sessionFrom"
22
+ :send-message-img="sendMessageImg"
23
+ :show-message-card="showMessageCard"
24
+ @getphonenumber="onGetPhoneNumber"
25
+ @getuserinfo="onGetUserInfo"
26
+ @error="onError"
27
+ @opensetting="onOpenSetting"
28
+ @launchapp="onLaunchApp"
29
+ @contact="onContact"
30
+ @chooseavatar="onChooseavatar"
31
+ @agreeprivacyauthorization="onAgreeprivacyauthorization"
32
+ @addgroupapp="onAddgroupapp"
33
+ @chooseaddress="onChooseaddress"
34
+ @subscribe="onSubscribe"
35
+ @login="onLogin"
36
+ @im="onIm"
37
+ :hover-class="!disabled && !loading && !plain ? 'uv-button--active' : ''"
38
+ class="uv-button uv-reset-button"
39
+ :style="[baseColor, $uv.addStyle(customStyle)]"
40
+ @tap="clickHandler"
41
+ :class="bemClass"
42
+ >
43
+ <!-- #endif -->
44
+ <!-- #ifndef MP -->
45
+ <button
46
+ :hover-start-time="Number(hoverStartTime)"
47
+ :hover-stay-time="Number(hoverStayTime)"
48
+ :form-type="formType"
49
+ :open-type="openType"
50
+ :app-parameter="appParameter"
51
+ :hover-stop-propagation="hoverStopPropagation"
52
+ :send-message-title="sendMessageTitle"
53
+ :send-message-path="sendMessagePath"
54
+ :lang="lang"
55
+ :data-name="dataName"
56
+ :session-from="sessionFrom"
57
+ :send-message-img="sendMessageImg"
58
+ :show-message-card="showMessageCard"
59
+ :hover-class="!disabled && !loading && !plain ? 'uv-button--active' : ''"
60
+ class="uv-button uv-reset-button"
61
+ :style="[baseColor, $uv.addStyle(customStyle)]"
62
+ @tap="clickHandler"
63
+ :class="bemClass"
64
+ >
65
+ <!-- #endif -->
66
+ <template v-if="loading">
67
+ <uv-loading-icon
68
+ :mode="loadingMode"
69
+ :size="loadingSize * 1.15"
70
+ :color="loadingColor"
71
+ ></uv-loading-icon>
72
+ <text
73
+ class="uv-button__loading-text"
74
+ :style="[
75
+ { fontSize: textSize + 'px' },
76
+ $uv.addStyle(customTextStyle)
77
+ ]"
78
+ >{{ loadingText || text }}</text>
79
+ </template>
80
+ <template v-else>
81
+ <uv-icon
82
+ v-if="icon"
83
+ :name="icon"
84
+ :color="iconColorCom"
85
+ :size="getIconSize"
86
+ :customStyle="{ marginRight: '2px' }"
87
+ ></uv-icon>
88
+ <slot>
89
+ <text
90
+ class="uv-button__text"
91
+ :style="[
92
+ { fontSize: textSize + 'px' },
93
+ $uv.addStyle(customTextStyle)
94
+ ]"
95
+ >{{ text }}</text>
96
+ </slot>
97
+ <slot name="suffix"></slot>
98
+ </template>
99
+ </button>
100
+ <!-- #endif -->
101
+ <!-- #ifdef APP-NVUE -->
102
+ <view
103
+ :hover-start-time="Number(hoverStartTime)"
104
+ :hover-stay-time="Number(hoverStayTime)"
105
+ class="uv-button"
106
+ :hover-class="!disabled && !loading && !plain ? 'uv-button--active' : ''"
107
+ @tap="clickHandler"
108
+ :class="bemClass"
109
+ :style="[baseColor, $uv.addStyle(customStyle)]"
110
+ >
111
+ <template v-if="loading">
112
+ <uv-loading-icon
113
+ :mode="loadingMode"
114
+ :size="loadingSize * 1.15"
115
+ :color="loadingColor"
116
+ ></uv-loading-icon>
117
+ <text
118
+ class="uv-button__loading-text"
119
+ :style="[nvueTextStyle,$uv.addStyle(customTextStyle)]"
120
+ :class="[plain && `uv-button__text--plain--${type}`]"
121
+ >{{ loadingText || text }}</text>
122
+ </template>
123
+ <template v-else>
124
+ <uv-icon
125
+ v-if="icon"
126
+ :name="icon"
127
+ :color="iconColorCom"
128
+ :size="getIconSize"
129
+ ></uv-icon>
130
+ <text
131
+ class="uv-button__text"
132
+ :style="[
133
+ {
134
+ marginLeft: icon ? '2px' : 0,
135
+ },
136
+ nvueTextStyle,
137
+ $uv.addStyle(customTextStyle)
138
+ ]"
139
+ :class="[plain && `uv-button__text--plain--${type}`]"
140
+ >{{ text }}</text>
141
+ <slot name="suffix"></slot>
142
+ </template>
143
+ </view>
144
+ <!-- #endif -->
145
+ </view>
146
+ </template>
147
+
148
+ <script>
149
+ import throttle from '../../libs/function/throttle.js';
150
+ import mpMixin from '../../libs/mixin/mpMixin.js'
151
+ import mixin from '../../libs/mixin/mixin.js'
152
+ import button from '../../libs/mixin/button.js'
153
+ import openType from '../../libs/mixin/openType.js'
154
+ import props from "./props.js";
155
+ /**
156
+ * button 按钮
157
+ * @description Button 按钮
158
+ * @tutorial https://www.uvui.cn/components/button.html
159
+ * @property {Boolean} hairline 是否显示按钮的细边框 (默认 true )
160
+ * @property {String} type 按钮的预置样式,info,primary,error,warning,success (默认 'info' )
161
+ * @property {String} size 按钮尺寸,large,normal,mini (默认 normal)
162
+ * @property {String} shape 按钮形状,circle(两边为半圆),square(带圆角) (默认 'square' )
163
+ * @property {Boolean} plain 按钮是否镂空,背景色透明 (默认 false)
164
+ * @property {Boolean} disabled 是否禁用 (默认 false)
165
+ * @property {Boolean} loading 按钮名称前是否带 loading 图标(App-nvue 平台,在 ios 上为雪花,Android上为圆圈) (默认 false)
166
+ * @property {String | Number} loadingText 加载中提示文字
167
+ * @property {String} loadingMode 加载状态图标类型 (默认 'spinner' )
168
+ * @property {String | Number} loadingSize 加载图标大小 (默认 15 )
169
+ * @property {String} openType 开放能力,具体请看uniapp稳定关于button组件部分说明
170
+ * @property {String} formType 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件
171
+ * @property {String} appParameter 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 (注:只微信小程序、QQ小程序有效)
172
+ * @property {Boolean} hoverStopPropagation 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效(默认 true )
173
+ * @property {String} lang 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文(默认 en )
174
+ * @property {String} sessionFrom 会话来源,openType="contact"时有效
175
+ * @property {String} sendMessageTitle 会话内消息卡片标题,openType="contact"时有效
176
+ * @property {String} sendMessagePath 会话内消息卡片点击跳转小程序路径,openType="contact"时有效
177
+ * @property {String} sendMessageImg 会话内消息卡片图片,openType="contact"时有效
178
+ * @property {Boolean} showMessageCard 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效(默认false)
179
+ * @property {String} dataName 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取
180
+ * @property {String | Number} throttleTime 节流,一定时间内只能触发一次 (默认 0 )
181
+ * @property {String | Number} hoverStartTime 按住后多久出现点击态,单位毫秒 (默认 0 )
182
+ * @property {String | Number} hoverStayTime 手指松开后点击态保留时间,单位毫秒 (默认 200 )
183
+ * @property {String | Number} text 按钮文字,之所以通过props传入,是因为slot传入的话(注:nvue中无法控制文字的样式)
184
+ * @property {String} icon 按钮图标
185
+ * @property {String} iconColor 按钮图标颜色
186
+ * @property {String} color 按钮颜色,支持传入linear-gradient渐变色
187
+ * @property {Object} customStyle 定义需要用到的外部样式
188
+ * @event {Function} click 非禁止并且非加载中,才能点击
189
+ * @event {Function} getphonenumber open-type="getPhoneNumber"时有效
190
+ * @event {Function} getuserinfo 用户点击该按钮时,会返回获取到的用户信息,从返回参数的detail中获取到的值同uni.getUserInfo
191
+ * @event {Function} error 当使用开放能力时,发生错误的回调
192
+ * @event {Function} opensetting 在打开授权设置页并关闭后回调
193
+ * @event {Function} launchapp 打开 APP 成功的回调
194
+ * @example <uv-button>月落</uv-button>
195
+ */
196
+ export default {
197
+ name: "uv-button",
198
+ // #ifdef MP
199
+ mixins: [mpMixin, mixin, button, openType, props],
200
+ // #endif
201
+ // #ifndef MP
202
+ mixins: [mpMixin, mixin, props],
203
+ // #endif
204
+ emits: ['click'],
205
+ data() {
206
+ return {};
207
+ },
208
+ computed: {
209
+ // 生成bem风格的类名
210
+ bemClass() {
211
+ // this.bem为一个computed变量,在mixin中
212
+ if (!this.color) {
213
+ return this.bem("button",
214
+ ["type", "shape", "size"],
215
+ ["disabled", "plain", "hairline"]);
216
+ } else {
217
+ // 由于nvue的原因,在有color参数时,不需要传入type,否则会生成type相关的类型,影响最终的样式
218
+ return this.bem("button",
219
+ ["shape", "size"],
220
+ ["disabled", "plain", "hairline"]);
221
+ }
222
+ },
223
+ loadingColor() {
224
+ if (this.plain) {
225
+ // 如果有设置color值,则用color值,否则使用type主题颜色
226
+ return this.color ? this.color : '#3c9cff';
227
+ }
228
+ if (this.type === "info") {
229
+ return "#c9c9c9";
230
+ }
231
+ return "rgb(200, 200, 200)";
232
+ },
233
+ iconColorCom() {
234
+ // 如果是镂空状态,设置了color就用color值,否则使用主题颜色,
235
+ // uv-icon的color能接受一个主题颜色的值
236
+ if (this.iconColor) return this.iconColor;
237
+ if (this.plain) {
238
+ return this.color ? this.color : this.type;
239
+ } else {
240
+ return this.type === "info" ? "#000000" : "#ffffff";
241
+ }
242
+ },
243
+ baseColor() {
244
+ let style = {};
245
+ if (this.color) {
246
+ // 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
247
+ style.color = this.plain ? this.color : "white";
248
+ if (!this.plain) {
249
+ // 非镂空,背景色使用自定义的颜色
250
+ style["background-color"] = this.color;
251
+ }
252
+ if (this.color.indexOf("gradient") !== -1) {
253
+ // 如果自定义的颜色为渐变色,不显示边框,以及通过backgroundImage设置渐变色
254
+ // weex文档说明可以写borderWidth的形式,为什么这里需要分开写?
255
+ // 因为weex是阿里巴巴为了部门业绩考核而做的你懂的东西,所以需要这么写才有效
256
+ style.borderTopWidth = 0;
257
+ style.borderRightWidth = 0;
258
+ style.borderBottomWidth = 0;
259
+ style.borderLeftWidth = 0;
260
+ if (!this.plain) {
261
+ style.backgroundImage = this.color;
262
+ }
263
+ } else {
264
+ // 非渐变色,则设置边框相关的属性
265
+ style.borderColor = this.color;
266
+ style.borderWidth = "1px";
267
+ style.borderStyle = "solid";
268
+ }
269
+ }
270
+ return style;
271
+ },
272
+ // nvue版本按钮的字体不会继承父组件的颜色,需要对每一个text组件进行单独的设置
273
+ nvueTextStyle() {
274
+ let style = {};
275
+ // 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
276
+ if (this.type === "info") {
277
+ style.color = "#323233";
278
+ }
279
+ if (this.color) {
280
+ style.color = this.plain ? this.color : "white";
281
+ }
282
+ style.fontSize = this.textSize + "px";
283
+ return style;
284
+ },
285
+ // 字体大小
286
+ textSize() {
287
+ let fontSize = 14,
288
+ { size } = this;
289
+ if (size === "large") fontSize = 16;
290
+ if (size === "normal") fontSize = 14;
291
+ if (size === "small") fontSize = 12;
292
+ if (size === "mini") fontSize = 10;
293
+ return fontSize;
294
+ },
295
+ // 设置图标大小
296
+ getIconSize() {
297
+ const size = this.iconSize ? this.iconSize : this.textSize * 1.35;
298
+ return this.$uv.addUnit(size);
299
+ },
300
+ // 设置外层盒子的宽度,其他样式不需要
301
+ btnWrapperStyle() {
302
+ const style = {};
303
+ const customStyle = this.$uv.addStyle(this.customStyle);
304
+ if(customStyle.width) style.width = customStyle.width;
305
+ return style;
306
+ }
307
+ },
308
+ methods: {
309
+ clickHandler() {
310
+ // 非禁止并且非加载中,才能点击
311
+ if (!this.disabled && !this.loading) {
312
+ // 进行节流控制,每this.throttle毫秒内,只在开始处执行
313
+ throttle(() => {
314
+ this.$emit("click");
315
+ }, this.throttleTime);
316
+ }
317
+ },
318
+ disabledHandler() {
319
+ if (this.disabled && !this.loading) {
320
+ throttle(() => {
321
+ this.$emit("disable");
322
+ }, this.throttleTime);
323
+ }
324
+ },
325
+ }
326
+ }
327
+ </script>
328
+
329
+ <style lang="scss" scoped>
330
+ $show-reset-button: 1;
331
+ @import '../../libs/css/variable.scss';
332
+ @import '../../libs/css/components.scss';
333
+ @import '../../libs/css/color.scss';
334
+
335
+ /* #ifndef APP-NVUE */
336
+ @import "./vue.scss";
337
+ /* #endif */
338
+
339
+ /* #ifdef APP-NVUE */
340
+ @import "./nvue.scss";
341
+ /* #endif */
342
+
343
+ $uv-button-uv-button-height: 40px !default;
344
+ $uv-button-text-font-size: 15px !default;
345
+ $uv-button-loading-text-font-size: 15px !default;
346
+ $uv-button-loading-text-margin-left: 4px !default;
347
+ $uv-button-large-width: 100% !default;
348
+ $uv-button-large-height: 50px !default;
349
+ $uv-button-normal-padding: 0 12px !default;
350
+ $uv-button-large-padding: 0 15px !default;
351
+ $uv-button-normal-font-size: 14px !default;
352
+ $uv-button-small-min-width: 60px !default;
353
+ $uv-button-small-height: 30px !default;
354
+ $uv-button-small-padding: 0px 8px !default;
355
+ $uv-button-mini-padding: 0px 8px !default;
356
+ $uv-button-small-font-size: 12px !default;
357
+ $uv-button-mini-height: 22px !default;
358
+ $uv-button-mini-font-size: 10px !default;
359
+ $uv-button-mini-min-width: 50px !default;
360
+ $uv-button-disabled-opacity: 0.5 !default;
361
+ $uv-button-info-color: #323233 !default;
362
+ $uv-button-info-background-color: #fff !default;
363
+ $uv-button-info-border-color: #ebedf0 !default;
364
+ $uv-button-info-border-width: 1px !default;
365
+ $uv-button-info-border-style: solid !default;
366
+ $uv-button-success-color: #fff !default;
367
+ $uv-button-success-background-color: $uv-success !default;
368
+ $uv-button-success-border-color: $uv-button-success-background-color !default;
369
+ $uv-button-success-border-width: 1px !default;
370
+ $uv-button-success-border-style: solid !default;
371
+ $uv-button-primary-color: #fff !default;
372
+ $uv-button-primary-background-color: $uv-primary !default;
373
+ $uv-button-primary-border-color: $uv-button-primary-background-color !default;
374
+ $uv-button-primary-border-width: 1px !default;
375
+ $uv-button-primary-border-style: solid !default;
376
+ $uv-button-error-color: #fff !default;
377
+ $uv-button-error-background-color: $uv-error !default;
378
+ $uv-button-error-border-color: $uv-button-error-background-color !default;
379
+ $uv-button-error-border-width: 1px !default;
380
+ $uv-button-error-border-style: solid !default;
381
+ $uv-button-warning-color: #fff !default;
382
+ $uv-button-warning-background-color: $uv-warning !default;
383
+ $uv-button-warning-border-color: $uv-button-warning-background-color !default;
384
+ $uv-button-warning-border-width: 1px !default;
385
+ $uv-button-warning-border-style: solid !default;
386
+ $uv-button-block-width: 100% !default;
387
+ $uv-button-circle-border-top-right-radius: 100px !default;
388
+ $uv-button-circle-border-top-left-radius: 100px !default;
389
+ $uv-button-circle-border-bottom-left-radius: 100px !default;
390
+ $uv-button-circle-border-bottom-right-radius: 100px !default;
391
+ $uv-button-square-border-top-right-radius: 3px !default;
392
+ $uv-button-square-border-top-left-radius: 3px !default;
393
+ $uv-button-square-border-bottom-left-radius: 3px !default;
394
+ $uv-button-square-border-bottom-right-radius: 3px !default;
395
+ $uv-button-icon-min-width: 1em !default;
396
+ $uv-button-plain-background-color: #fff !default;
397
+ $uv-button-hairline-border-width: 0.5px !default;
398
+
399
+ .uv-button {
400
+ height: $uv-button-uv-button-height;
401
+ position: relative;
402
+ align-items: center;
403
+ justify-content: center;
404
+ @include flex;
405
+ /* #ifndef APP-NVUE */
406
+ box-sizing: border-box;
407
+ /* #endif */
408
+ flex-direction: row;
409
+
410
+ &__text {
411
+ font-size: $uv-button-text-font-size;
412
+ }
413
+
414
+ &__loading-text {
415
+ font-size: $uv-button-loading-text-font-size;
416
+ margin-left: $uv-button-loading-text-margin-left;
417
+ }
418
+
419
+ &--large {
420
+ /* #ifndef APP-NVUE */
421
+ width: $uv-button-large-width;
422
+ /* #endif */
423
+ height: $uv-button-large-height;
424
+ padding: $uv-button-large-padding;
425
+ }
426
+
427
+ &--normal {
428
+ padding: $uv-button-normal-padding;
429
+ font-size: $uv-button-normal-font-size;
430
+ }
431
+
432
+ &--small {
433
+ /* #ifndef APP-NVUE */
434
+ min-width: $uv-button-small-min-width;
435
+ /* #endif */
436
+ height: $uv-button-small-height;
437
+ padding: $uv-button-small-padding;
438
+ font-size: $uv-button-small-font-size;
439
+ }
440
+
441
+ &--mini {
442
+ height: $uv-button-mini-height;
443
+ font-size: $uv-button-mini-font-size;
444
+ /* #ifndef APP-NVUE */
445
+ min-width: $uv-button-mini-min-width;
446
+ /* #endif */
447
+ padding: $uv-button-mini-padding;
448
+ }
449
+
450
+ &--disabled {
451
+ opacity: $uv-button-disabled-opacity;
452
+ }
453
+
454
+ &--info {
455
+ color: $uv-button-info-color;
456
+ background-color: $uv-button-info-background-color;
457
+ border-color: $uv-button-info-border-color;
458
+ border-width: $uv-button-info-border-width;
459
+ border-style: $uv-button-info-border-style;
460
+ }
461
+
462
+ &--success {
463
+ color: $uv-button-success-color;
464
+ background-color: $uv-button-success-background-color;
465
+ border-color: $uv-button-success-border-color;
466
+ border-width: $uv-button-success-border-width;
467
+ border-style: $uv-button-success-border-style;
468
+ }
469
+
470
+ &--primary {
471
+ color: $uv-button-primary-color;
472
+ background-color: $uv-button-primary-background-color;
473
+ border-color: $uv-button-primary-border-color;
474
+ border-width: $uv-button-primary-border-width;
475
+ border-style: $uv-button-primary-border-style;
476
+ }
477
+
478
+ &--error {
479
+ color: $uv-button-error-color;
480
+ background-color: $uv-button-error-background-color;
481
+ border-color: $uv-button-error-border-color;
482
+ border-width: $uv-button-error-border-width;
483
+ border-style: $uv-button-error-border-style;
484
+ }
485
+
486
+ &--warning {
487
+ color: $uv-button-warning-color;
488
+ background-color: $uv-button-warning-background-color;
489
+ border-color: $uv-button-warning-border-color;
490
+ border-width: $uv-button-warning-border-width;
491
+ border-style: $uv-button-warning-border-style;
492
+ }
493
+
494
+ &--block {
495
+ @include flex;
496
+ width: $uv-button-block-width;
497
+ }
498
+
499
+ &--circle {
500
+ border-top-right-radius: $uv-button-circle-border-top-right-radius;
501
+ border-top-left-radius: $uv-button-circle-border-top-left-radius;
502
+ border-bottom-left-radius: $uv-button-circle-border-bottom-left-radius;
503
+ border-bottom-right-radius: $uv-button-circle-border-bottom-right-radius;
504
+ }
505
+
506
+ &--square {
507
+ border-bottom-left-radius: $uv-button-square-border-top-right-radius;
508
+ border-bottom-right-radius: $uv-button-square-border-top-left-radius;
509
+ border-top-left-radius: $uv-button-square-border-bottom-left-radius;
510
+ border-top-right-radius: $uv-button-square-border-bottom-right-radius;
511
+ }
512
+
513
+ &__icon {
514
+ /* #ifndef APP-NVUE */
515
+ min-width: $uv-button-icon-min-width;
516
+ line-height: inherit !important;
517
+ vertical-align: top;
518
+ /* #endif */
519
+ }
520
+
521
+ &--plain {
522
+ background-color: $uv-button-plain-background-color;
523
+ }
524
+
525
+ &--hairline {
526
+ border-width: $uv-button-hairline-border-width !important;
527
+ }
528
+ }
529
+ </style>
@@ -0,0 +1,93 @@
1
+ @import '../../libs/css/color.scss';
2
+ // nvue下hover-class无效
3
+ $uv-button-before-top:50% !default;
4
+ $uv-button-before-left:50% !default;
5
+ $uv-button-before-width:100% !default;
6
+ $uv-button-before-height:100% !default;
7
+ $uv-button-before-transform:translate(-50%, -50%) !default;
8
+ $uv-button-before-opacity:0 !default;
9
+ $uv-button-before-background-color:#000 !default;
10
+ $uv-button-before-border-color:#000 !default;
11
+ $uv-button-active-before-opacity:.15 !default;
12
+ $uv-button-icon-margin-left:4px !default;
13
+ $uv-button-plain-uv-button-info-color:$uv-info;
14
+ $uv-button-plain-uv-button-success-color:$uv-success;
15
+ $uv-button-plain-uv-button-error-color:$uv-error;
16
+ $uv-button-plain-uv-button-warning-color:$uv-warning;
17
+
18
+ .uv-button-wrapper {
19
+ position: relative;
20
+ &--dis {
21
+ position: absolute;
22
+ left: 0;
23
+ top: 0;
24
+ right: 0;
25
+ bottom: 0;
26
+ z-index: 9;
27
+ }
28
+ }
29
+
30
+ .uv-button {
31
+ width: 100%;
32
+
33
+ &__text {
34
+ white-space: nowrap;
35
+ line-height: 1;
36
+ }
37
+
38
+ &:before {
39
+ position: absolute;
40
+ top:$uv-button-before-top;
41
+ left:$uv-button-before-left;
42
+ width:$uv-button-before-width;
43
+ height:$uv-button-before-height;
44
+ border: inherit;
45
+ border-radius: inherit;
46
+ transform:$uv-button-before-transform;
47
+ opacity:$uv-button-before-opacity;
48
+ content: " ";
49
+ background-color:$uv-button-before-background-color;
50
+ border-color:$uv-button-before-border-color;
51
+ }
52
+
53
+ &--active {
54
+ &:before {
55
+ opacity: .15
56
+ }
57
+ }
58
+
59
+ &__icon+&__text:not(:empty),
60
+ &__loading-text {
61
+ margin-left:$uv-button-icon-margin-left;
62
+ }
63
+
64
+ &--plain {
65
+ &.uv-button--primary {
66
+ color: $uv-primary;
67
+ }
68
+ }
69
+
70
+ &--plain {
71
+ &.uv-button--info {
72
+ color:$uv-button-plain-uv-button-info-color;
73
+ }
74
+ }
75
+
76
+ &--plain {
77
+ &.uv-button--success {
78
+ color:$uv-button-plain-uv-button-success-color;
79
+ }
80
+ }
81
+
82
+ &--plain {
83
+ &.uv-button--error {
84
+ color:$uv-button-plain-uv-button-error-color;
85
+ }
86
+ }
87
+
88
+ &--plain {
89
+ &.uv-button--warning {
90
+ color:$uv-button-plain-uv-button-warning-color;
91
+ }
92
+ }
93
+ }