uview-pro 0.0.19 → 0.0.20

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 (230) hide show
  1. package/changelog.md +305 -283
  2. package/components/u-action-sheet/types.ts +35 -35
  3. package/components/u-action-sheet/u-action-sheet.vue +160 -160
  4. package/components/u-alert-tips/types.ts +39 -39
  5. package/components/u-alert-tips/u-alert-tips.vue +212 -212
  6. package/components/u-avatar/types.ts +34 -34
  7. package/components/u-avatar/u-avatar.vue +193 -193
  8. package/components/u-avatar-cropper/types.ts +23 -23
  9. package/components/u-avatar-cropper/u-avatar-cropper.vue +286 -286
  10. package/components/u-avatar-cropper/weCropper.d.ts +62 -62
  11. package/components/u-avatar-cropper/weCropper.js +1253 -1253
  12. package/components/u-avatar-cropper/weCropper.ts +1255 -1255
  13. package/components/u-back-top/types.ts +39 -39
  14. package/components/u-back-top/u-back-top.vue +125 -125
  15. package/components/u-badge/types.ts +36 -36
  16. package/components/u-badge/u-badge.vue +165 -165
  17. package/components/u-button/types.ts +66 -66
  18. package/components/u-button/u-button.vue +554 -554
  19. package/components/u-calendar/types.ts +63 -63
  20. package/components/u-calendar/u-calendar.vue +592 -592
  21. package/components/u-car-keyboard/types.ts +12 -12
  22. package/components/u-car-keyboard/u-car-keyboard.vue +234 -234
  23. package/components/u-card/types.ts +59 -59
  24. package/components/u-card/u-card.vue +194 -194
  25. package/components/u-cell-group/types.ts +17 -17
  26. package/components/u-cell-group/u-cell-group.vue +50 -50
  27. package/components/u-cell-item/types.ts +54 -54
  28. package/components/u-cell-item/u-cell-item.vue +202 -202
  29. package/components/u-checkbox/types.ts +31 -31
  30. package/components/u-checkbox/u-checkbox.vue +267 -267
  31. package/components/u-checkbox-group/types.ts +32 -32
  32. package/components/u-checkbox-group/u-checkbox-group.vue +79 -79
  33. package/components/u-circle-progress/types.ts +52 -52
  34. package/components/u-circle-progress/u-circle-progress.vue +189 -189
  35. package/components/u-city-select/types.ts +20 -20
  36. package/components/u-city-select/u-city-select.vue +236 -236
  37. package/components/u-col/types.ts +30 -30
  38. package/components/u-col/u-col.vue +123 -123
  39. package/components/u-collapse/types.ts +31 -31
  40. package/components/u-collapse/u-collapse.vue +68 -68
  41. package/components/u-collapse-item/types.ts +25 -25
  42. package/components/u-collapse-item/u-collapse-item.vue +176 -176
  43. package/components/u-column-notice/types.ts +48 -48
  44. package/components/u-column-notice/u-column-notice.vue +176 -176
  45. package/components/u-count-down/types.ts +42 -42
  46. package/components/u-count-down/u-count-down.vue +258 -258
  47. package/components/u-count-to/types.ts +32 -32
  48. package/components/u-count-to/u-count-to.vue +241 -241
  49. package/components/u-divider/types.ts +31 -31
  50. package/components/u-divider/u-divider.vue +121 -121
  51. package/components/u-dropdown/types.ts +32 -32
  52. package/components/u-dropdown/u-dropdown.vue +289 -289
  53. package/components/u-dropdown-item/types.ts +27 -27
  54. package/components/u-dropdown-item/u-dropdown-item.vue +123 -123
  55. package/components/u-empty/types.ts +36 -36
  56. package/components/u-empty/u-empty.vue +88 -88
  57. package/components/u-field/types.ts +69 -69
  58. package/components/u-field/u-field.vue +354 -354
  59. package/components/u-full-screen/types.ts +14 -14
  60. package/components/u-full-screen/u-full-screen.vue +82 -82
  61. package/components/u-gap/types.ts +18 -18
  62. package/components/u-gap/u-gap.vue +40 -40
  63. package/components/u-grid/types.ts +19 -19
  64. package/components/u-grid/u-grid.vue +93 -93
  65. package/components/u-grid-item/types.ts +16 -16
  66. package/components/u-grid-item/u-grid-item.vue +130 -130
  67. package/components/u-icon/types.ts +62 -62
  68. package/components/u-icon/u-icon.vue +274 -274
  69. package/components/u-image/types.ts +51 -51
  70. package/components/u-image/u-image.vue +222 -222
  71. package/components/u-index-anchor/types.ts +16 -16
  72. package/components/u-index-anchor/u-index-anchor.vue +86 -86
  73. package/components/u-index-list/types.ts +43 -43
  74. package/components/u-index-list/u-index-list.vue +355 -355
  75. package/components/u-input/types.ts +140 -140
  76. package/components/u-input/u-input.vue +255 -255
  77. package/components/u-keyboard/types.ts +40 -40
  78. package/components/u-keyboard/u-keyboard.vue +158 -158
  79. package/components/u-lazy-load/types.ts +37 -37
  80. package/components/u-lazy-load/u-lazy-load.vue +233 -233
  81. package/components/u-line/types.ts +44 -44
  82. package/components/u-line/u-line.vue +59 -59
  83. package/components/u-line-progress/types.ts +58 -58
  84. package/components/u-line-progress/u-line-progress.vue +109 -109
  85. package/components/u-link/types.ts +43 -43
  86. package/components/u-link/u-link.vue +75 -75
  87. package/components/u-loading/types.ts +35 -35
  88. package/components/u-loading/u-loading.vue +90 -90
  89. package/components/u-loading-popup/types.ts +26 -26
  90. package/components/u-loading-popup/u-loading-popup.vue +239 -239
  91. package/components/u-loadmore/types.ts +79 -79
  92. package/components/u-loadmore/u-loadmore.vue +140 -140
  93. package/components/u-mask/types.ts +43 -43
  94. package/components/u-mask/u-mask.vue +106 -106
  95. package/components/u-message-input/types.ts +74 -74
  96. package/components/u-message-input/u-message-input.vue +255 -255
  97. package/components/u-modal/types.ts +118 -118
  98. package/components/u-modal/u-modal.vue +200 -200
  99. package/components/u-navbar/types.ts +103 -103
  100. package/components/u-navbar/u-navbar.vue +226 -226
  101. package/components/u-no-network/image.ts +2 -2
  102. package/components/u-no-network/types.ts +28 -28
  103. package/components/u-no-network/u-no-network.vue +290 -290
  104. package/components/u-notice-bar/types.ts +111 -111
  105. package/components/u-notice-bar/u-notice-bar.vue +174 -174
  106. package/components/u-number-box/types.ts +42 -42
  107. package/components/u-number-box/u-number-box.vue +312 -312
  108. package/components/u-number-keyboard/types.ts +26 -26
  109. package/components/u-number-keyboard/u-number-keyboard.vue +166 -166
  110. package/components/u-picker/types.ts +111 -111
  111. package/components/u-picker/u-picker.vue +637 -637
  112. package/components/u-popup/types.ts +59 -59
  113. package/components/u-popup/u-popup.vue +359 -359
  114. package/components/u-radio/types.ts +25 -25
  115. package/components/u-radio/u-radio.vue +258 -258
  116. package/components/u-radio-group/types.ts +29 -29
  117. package/components/u-radio-group/u-radio-group.vue +98 -98
  118. package/components/u-rate/types.ts +40 -40
  119. package/components/u-rate/u-rate.vue +234 -234
  120. package/components/u-read-more/types.ts +35 -35
  121. package/components/u-read-more/u-read-more.vue +150 -150
  122. package/components/u-row/types.ts +20 -20
  123. package/components/u-row/u-row.vue +87 -87
  124. package/components/u-row-notice/types.ts +39 -39
  125. package/components/u-row-notice/u-row-notice.vue +213 -213
  126. package/components/u-search/types.ts +53 -53
  127. package/components/u-search/u-search.vue +256 -256
  128. package/components/u-section/types.ts +32 -32
  129. package/components/u-section/u-section.vue +125 -125
  130. package/components/u-select/types.ts +43 -43
  131. package/components/u-select/u-select.vue +361 -361
  132. package/components/u-skeleton/types.ts +20 -20
  133. package/components/u-skeleton/u-skeleton.vue +205 -205
  134. package/components/u-slider/types.ts +32 -32
  135. package/components/u-slider/u-slider.vue +238 -238
  136. package/components/u-steps/types.ts +28 -28
  137. package/components/u-steps/u-steps.vue +160 -160
  138. package/components/u-sticky/types.ts +22 -22
  139. package/components/u-sticky/u-sticky.vue +159 -159
  140. package/components/u-subsection/types.ts +36 -36
  141. package/components/u-subsection/u-subsection.vue +328 -328
  142. package/components/u-swipe-action/types.ts +50 -50
  143. package/components/u-swipe-action/u-swipe-action.vue +253 -253
  144. package/components/u-swiper/types.ts +47 -47
  145. package/components/u-swiper/u-swiper.vue +266 -266
  146. package/components/u-switch/types.ts +28 -28
  147. package/components/u-switch/u-switch.vue +128 -128
  148. package/components/u-tabbar/types.ts +36 -36
  149. package/components/u-tabbar/u-tabbar.vue +280 -280
  150. package/components/u-table/types.ts +25 -25
  151. package/components/u-table/u-table.vue +55 -55
  152. package/components/u-tabs/types.ts +51 -51
  153. package/components/u-tabs/u-tabs.vue +284 -284
  154. package/components/u-tabs-swiper/types.ts +53 -53
  155. package/components/u-tabs-swiper/u-tabs-swiper.vue +379 -379
  156. package/components/u-tag/types.ts +37 -37
  157. package/components/u-tag/u-tag.vue +244 -244
  158. package/components/u-td/types.ts +12 -12
  159. package/components/u-td/u-td.vue +69 -69
  160. package/components/u-th/types.ts +12 -12
  161. package/components/u-th/u-th.vue +63 -63
  162. package/components/u-time-line/u-time-line.vue +39 -39
  163. package/components/u-time-line-item/types.ts +14 -14
  164. package/components/u-time-line-item/u-time-line-item.vue +78 -78
  165. package/components/u-toast/types.ts +36 -36
  166. package/components/u-toast/u-toast.vue +233 -233
  167. package/components/u-top-tips/types.ts +14 -14
  168. package/components/u-top-tips/u-top-tips.vue +113 -113
  169. package/components/u-tr/types.ts +8 -8
  170. package/components/u-tr/u-tr.vue +24 -24
  171. package/components/u-upload/types.ts +71 -71
  172. package/components/u-upload/u-upload.vue +545 -545
  173. package/components/u-verification-code/types.ts +22 -22
  174. package/components/u-verification-code/u-verification-code.vue +164 -164
  175. package/components/u-waterfall/types.ts +16 -16
  176. package/components/u-waterfall/u-waterfall.vue +175 -175
  177. package/iconfont.css +910 -910
  178. package/index.scss +22 -22
  179. package/index.ts +195 -195
  180. package/libs/config/config.ts +26 -26
  181. package/libs/config/zIndex.ts +37 -37
  182. package/libs/css/color.scss +155 -155
  183. package/libs/css/common.scss +175 -175
  184. package/libs/css/style.components.scss +6 -6
  185. package/libs/css/style.h5.scss +8 -8
  186. package/libs/css/style.mp.scss +72 -72
  187. package/libs/css/style.nvue.scss +2 -2
  188. package/libs/css/style.vue.scss +175 -175
  189. package/libs/function/$parent.ts +22 -22
  190. package/libs/function/addUnit.ts +13 -13
  191. package/libs/function/color.ts +36 -36
  192. package/libs/function/colorGradient.ts +125 -125
  193. package/libs/function/debounce.ts +28 -28
  194. package/libs/function/deepClone.ts +39 -39
  195. package/libs/function/deepMerge.ts +34 -34
  196. package/libs/function/getParent.ts +58 -58
  197. package/libs/function/getRect.ts +26 -26
  198. package/libs/function/guid.ts +42 -42
  199. package/libs/function/md5.ts +398 -398
  200. package/libs/function/parent.ts +21 -21
  201. package/libs/function/queryParams.ts +60 -60
  202. package/libs/function/random.ts +16 -16
  203. package/libs/function/randomArray.ts +11 -11
  204. package/libs/function/route.ts +118 -118
  205. package/libs/function/sys.ts +15 -15
  206. package/libs/function/test.ts +229 -229
  207. package/libs/function/throttle.ts +31 -31
  208. package/libs/function/timeFormat.ts +54 -54
  209. package/libs/function/timeFrom.ts +48 -48
  210. package/libs/function/toast.ts +14 -14
  211. package/libs/function/trim.ts +21 -21
  212. package/libs/function/type2icon.ts +36 -36
  213. package/libs/hooks/useEmitter.ts +77 -77
  214. package/libs/hooks/useParent.ts +29 -29
  215. package/libs/request/auto-http.ts +76 -76
  216. package/libs/request/index.ts +223 -223
  217. package/libs/store/index.ts +88 -88
  218. package/libs/util/async-validator.d.ts +62 -62
  219. package/libs/util/async-validator.js +1356 -1356
  220. package/libs/util/emitter.ts +112 -112
  221. package/libs/util/mitt.ts +118 -118
  222. package/libs/util/parent.ts +20 -20
  223. package/package.json +1 -1
  224. package/readme.md +231 -231
  225. package/theme.scss +38 -38
  226. package/types/components.d.ts +95 -95
  227. package/types/global.d.ts +221 -221
  228. package/types/ignore-errors.d.ts +30 -30
  229. package/types/index.d.ts +90 -90
  230. package/types/uni-app.d.ts +63 -63
@@ -1,554 +1,554 @@
1
- <template>
2
- <button
3
- id="u-wave-btn"
4
- class="u-btn u-line-1 u-fix-ios-appearance"
5
- :class="[
6
- 'u-size-' + size,
7
- plain ? 'u-btn--' + type + '--plain' : '',
8
- loading ? 'u-loading' : '',
9
- shape === 'circle' ? 'u-round-circle' : '',
10
- hairLine ? showHairLineBorder : 'u-btn--bold-border',
11
- 'u-btn--' + type,
12
- disabled ? `u-btn--${type}--disabled` : ''
13
- ]"
14
- :hover-start-time="Number(hoverStartTime)"
15
- :hover-stay-time="Number(hoverStayTime)"
16
- :disabled="disabled"
17
- :form-type="formType"
18
- :open-type="disabled || loading ? undefined : openType"
19
- :app-parameter="appParameter"
20
- :hover-stop-propagation="hoverStopPropagation"
21
- :send-message-title="sendMessageTitle"
22
- send-message-path="sendMessagePath"
23
- :lang="lang"
24
- :data-name="dataName"
25
- :session-from="sessionFrom"
26
- :send-message-img="sendMessageImg"
27
- :show-message-card="showMessageCard"
28
- @getAuthorize="getAuthorize"
29
- @getuserinfo="getuserinfo"
30
- @contact="contact"
31
- @getphonenumber="getphonenumber"
32
- @error="error"
33
- @launchapp="launchapp"
34
- @opensetting="opensetting"
35
- @chooseavatar="chooseavatar"
36
- @agreeprivacyauthorization="agreeprivacyauthorization"
37
- :style="[
38
- customStyle,
39
- {
40
- overflow: ripple ? 'hidden' : 'visible'
41
- }
42
- ]"
43
- @tap.stop="click($event)"
44
- :hover-class="getHoverClass"
45
- :loading="loading"
46
- >
47
- <slot></slot>
48
- <view
49
- v-if="ripple"
50
- class="u-wave-ripple"
51
- :class="[waveActive ? 'u-wave-active' : '']"
52
- :style="{
53
- top: rippleTop + 'px',
54
- left: rippleLeft + 'px',
55
- width: fields.targetWidth + 'px',
56
- height: fields.targetWidth + 'px',
57
- 'background-color': rippleBgColor || 'rgba(0, 0, 0, 0.15)'
58
- }"
59
- ></view>
60
- </button>
61
- </template>
62
-
63
- <script setup lang="ts">
64
- import { ref, computed, nextTick } from 'vue';
65
- import { $u } from '../../';
66
- import { ButtonProps } from './types';
67
-
68
- defineOptions({
69
- name: 'u-button'
70
- });
71
- /**
72
- * button 按钮
73
- * @description Button 按钮
74
- * @tutorial https://uview-pro.netlify.app/components/button.html
75
- * @property {String} size 按钮的大小
76
- * @property {Boolean} ripple 是否开启点击水波纹效果
77
- * @property {String} ripple-bg-color 水波纹的背景色,ripple为true时有效
78
- * @property {String} type 按钮的样式类型
79
- * @property {Boolean} plain 按钮是否镂空,背景色透明
80
- * @property {Boolean} disabled 是否禁用
81
- * @property {Boolean} hair-line 是否显示按钮的细边框(默认true)
82
- * @property {String} shape 按钮外观形状,见文档说明
83
- * @property {Boolean} loading 按钮名称前是否带 loading 图标(App-nvue 平台,在 ios 上为雪花,Android上为圆圈)
84
- * @property {String} form-type 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件
85
- * @property {String} open-type 开放能力
86
- * @property {String} data-name 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取
87
- * @property {String} hover-class 指定按钮按下去的样式类。当 hover-class="none" 时,没有点击态效果(App-nvue 平台暂不支持)
88
- * @property {Number} hover-start-time 按住后多久出现点击态,单位毫秒
89
- * @property {Number} hover-stay-time 手指松开后点击态保留时间,单位毫秒
90
- * @property {Object} custom-style 对按钮的自定义样式,对象形式,见文档说明
91
- * @property {String} app-parameter 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效
92
- * @property {Boolean} hover-stop-propagation 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效
93
- * @property {String} lang 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。只微信小程序有效
94
- * @property {String} session-from 会话来源,open-type="contact"时有效。只微信小程序有效
95
- * @property {String} send-message-title 会话内消息卡片标题,open-type="contact"时有效
96
- * @property {String} send-message-path 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效
97
- * @property {String} send-message-img 会话内消息卡片图片,open-type="contact"时有效
98
- * @property {Boolean} show-message-card 是否显示会话内消息卡片,open-type="contact"时有效
99
- * @property {Number|String} throttle-time 节流,一定时间内只能触发一次,单位毫秒
100
- * @property {String} scope 支付宝小程序,当 open-type 为 getAuthorize 时有效。可选值:'phoneNumber' | 'userInfo'
101
- * @event {Function} click 按钮点击
102
- * @event {Function} getphonenumber open-type="getPhoneNumber"时有效
103
- * @event {Function} getuserinfo 用户点击该按钮时,会返回获取到的用户信息,从返回参数的detail中获取到的值同uni.getUserInfo
104
- * @event {Function} error 当使用开放能力时,发生错误的回调
105
- * @event {Function} opensetting 在打开授权设置页并关闭后回调
106
- * @event {Function} launchapp 打开 APP 成功的回调
107
- * @event {Function} contact 客服消息回调
108
- * @event {Function} chooseavatar 头像选择回调
109
- * @event {Function} agreeprivacyauthorization 用户点击允许授权回调
110
- * @example <u-button>月落</u-button>
111
- */
112
-
113
- const emit = defineEmits(['click', 'getuserinfo', 'contact', 'getphonenumber', 'error', 'launchapp', 'opensetting', 'chooseavatar', 'agreeprivacyauthorization']);
114
-
115
- const props = defineProps(ButtonProps);
116
-
117
- /**
118
- * 按钮水波纹相关状态
119
- */
120
- const rippleTop = ref(0); // 水波纹的起点Y坐标到按钮上边界的距离
121
- const rippleLeft = ref(0); // 水波纹起点X坐标到按钮左边界的距离
122
- const fields = ref<Record<string, any>>({}); // 波纹按钮节点信息
123
- const waveActive = ref(false); // 激活水波纹
124
-
125
- /**
126
- * 当没有传bgColor变量时,按钮按下去的颜色类名
127
- * @returns {string}
128
- */
129
- const getHoverClass = computed(() => {
130
- // 如果开启水波纹效果,则不启用hover-class效果
131
- if (props.loading || props.disabled || props.ripple || props.hoverClass) return '';
132
- let hoverClass = '';
133
- hoverClass = props.plain ? 'u-' + props.type + '-plain-hover' : 'u-' + props.type + '-hover';
134
- return hoverClass;
135
- });
136
-
137
- /**
138
- * 在'primary', 'success', 'error', 'warning'类型下,不显示边框,否则会造成四角有毛刺现象
139
- * @returns {string}
140
- */
141
- const showHairLineBorder = computed(() => {
142
- if (['primary', 'success', 'error', 'warning'].indexOf(props.type) >= 0 && !props.plain) {
143
- return '';
144
- } else {
145
- return 'u-hairline-border';
146
- }
147
- });
148
-
149
- /**
150
- * 按钮点击
151
- * @param e 事件对象
152
- * @emits click
153
- */
154
- function click(e: any) {
155
- $u.throttle(() => {
156
- // 如果按钮时disabled和loading状态,不触发水波纹效果
157
- if (props.loading === true || props.disabled === true) return;
158
- // 是否开启水波纹效果
159
- if (props.ripple) {
160
- // 每次点击时,移除上一次的类,再次添加,才能触发动画效果
161
- waveActive.value = false;
162
- nextTick(() => {
163
- getWaveQuery(e);
164
- });
165
- }
166
- emit('click', e);
167
- }, Number(props.throttleTime));
168
- }
169
-
170
- /**
171
- * 查询按钮的节点信息
172
- * @param e 事件对象
173
- */
174
- function getWaveQuery(e: any) {
175
- getElQuery().then((res: any[]) => {
176
- // 查询返回的是一个数组节点
177
- let data = res[0];
178
- // 查询不到节点信息,不操作
179
- if (!data.width || !data.width) return;
180
- // 水波纹的最终形态是一个正方形(通过border-radius让其变为一个圆形),这里要保证正方形的边长等于按钮的最长边
181
- // 最终的方形(变换后的圆形)才能覆盖整个按钮
182
- data.targetWidth = data.height > data.width ? data.height : data.width;
183
- if (!data.targetWidth) return;
184
- fields.value = data;
185
- let touchesX = '',
186
- touchesY = '';
187
- // #ifdef MP-BAIDU
188
- // @ts-ignore
189
- touchesX = e.changedTouches[0].clientX;
190
- touchesY = e.changedTouches[0].clientY;
191
- // #endif
192
- // #ifdef MP-ALIPAY
193
- // @ts-ignore
194
- touchesX = e.detail.clientX;
195
- touchesY = e.detail.clientY;
196
- // #endif
197
- // #ifndef MP-BAIDU || MP-ALIPAY
198
- // @ts-ignore
199
- touchesX = e.touches[0].clientX;
200
- touchesY = e.touches[0].clientY;
201
- // #endif
202
- // 获取触摸点相对于按钮上边和左边的x和y坐标,原理是通过屏幕的触摸点(touchesY),减去按钮的上边界data.top
203
- // 但是由于`transform-origin`默认是center,所以这里再减去半径才是水波纹view应该的位置
204
- // 总的来说,就是把水波纹的矩形(变换后的圆形)的中心点,移动到我们的触摸点位置
205
- rippleTop.value = Number(touchesY) - data.top - data.targetWidth / 2;
206
- rippleLeft.value = Number(touchesX) - data.left - data.targetWidth / 2;
207
- nextTick(() => {
208
- waveActive.value = true;
209
- });
210
- });
211
- }
212
-
213
- /**
214
- * 获取节点信息
215
- * @returns {Promise<any[]>}
216
- */
217
- function getElQuery(): Promise<any[]> {
218
- return new Promise(resolve => {
219
- let queryInfo: any = '';
220
- // 获取元素节点信息,请查看uniapp相关文档
221
- // https://uniapp.dcloud.io/api/ui/nodes-info?id=nodesrefboundingclientrect
222
- // @ts-ignore
223
- queryInfo = uni.createSelectorQuery().in(null);
224
- // #ifdef MP-ALIPAY
225
- // @ts-ignore
226
- queryInfo = uni.createSelectorQuery();
227
- // #endif
228
- queryInfo.select('.u-btn').boundingClientRect();
229
- queryInfo.exec((data: any) => {
230
- resolve(data);
231
- });
232
- });
233
- }
234
-
235
- // 下面为对接uniapp官方按钮开放能力事件回调的对接
236
- /**
237
- * open-type="getPhoneNumber"时有效
238
- */
239
- function getphonenumber(event: any) {
240
- emit('getphonenumber', event);
241
- }
242
- /**
243
- * 用户点击该按钮时,会返回获取到的用户信息,从返回参数的detail中获取到的值同uni.getUserInfo
244
- */
245
- function getuserinfo(event: any) {
246
- emit('getuserinfo', event);
247
- }
248
- /**
249
- * 当使用开放能力时,发生错误的回调
250
- */
251
- function error(event: any) {
252
- emit('error', event);
253
- }
254
- /**
255
- * 在打开授权设置页并关闭后回调
256
- */
257
- function opensetting(event: any) {
258
- emit('opensetting', event);
259
- }
260
- /**
261
- * 打开 APP 成功的回调
262
- */
263
- function launchapp(event: any) {
264
- emit('launchapp', event);
265
- }
266
-
267
- /**
268
- * 支付宝小程序授权
269
- * @param event
270
- */
271
- function getAuthorize(event: any) {
272
- if (props.scope === 'phoneNumber') {
273
- getphonenumber(event);
274
- } else if (props.scope === 'userInfo') {
275
- getuserinfo(event);
276
- }
277
- }
278
-
279
- /**
280
- * 客服消息回调
281
- * @param event
282
- */
283
- function contact(event: any) {
284
- emit('contact', event);
285
- }
286
- /**
287
- * 头像选择回调
288
- * @param event
289
- */
290
- function chooseavatar(event: any) {
291
- emit('chooseavatar', event);
292
- }
293
- /**
294
- * 用户点击允许授权回调
295
- * @param event
296
- */
297
- function agreeprivacyauthorization(event: any) {
298
- emit('agreeprivacyauthorization', event);
299
- }
300
- </script>
301
-
302
- <style scoped lang="scss">
303
- @import '../../libs/css/style.components.scss';
304
- .u-btn::after {
305
- border: none;
306
- }
307
-
308
- .u-btn {
309
- position: relative;
310
- border: 0;
311
- //border-radius: 10rpx;
312
- /* #ifndef APP-NVUE */
313
- display: inline-flex;
314
- /* #endif */
315
- // 避免边框某些场景可能被“裁剪”,不能设置为hidden
316
- overflow: visible;
317
- line-height: 1;
318
- @include vue-flex;
319
- align-items: center;
320
- justify-content: center;
321
- cursor: pointer;
322
- padding: 0 40rpx;
323
- z-index: 1;
324
- box-sizing: border-box;
325
- transition: all 0.15s;
326
-
327
- &--bold-border {
328
- border: 1px solid #ffffff;
329
- }
330
-
331
- &--default {
332
- color: $u-content-color;
333
- border-color: #c0c4cc;
334
- background-color: #ffffff;
335
- }
336
-
337
- &--primary {
338
- color: #ffffff;
339
- border-color: $u-type-primary;
340
- background-color: $u-type-primary;
341
- }
342
-
343
- &--success {
344
- color: #ffffff;
345
- border-color: $u-type-success;
346
- background-color: $u-type-success;
347
- }
348
-
349
- &--error {
350
- color: #ffffff;
351
- border-color: $u-type-error;
352
- background-color: $u-type-error;
353
- }
354
-
355
- &--warning {
356
- color: #ffffff;
357
- border-color: $u-type-warning;
358
- background-color: $u-type-warning;
359
- }
360
-
361
- &--default--disabled {
362
- color: #ffffff;
363
- border-color: #e4e7ed;
364
- background-color: #ffffff;
365
- }
366
-
367
- &--primary--disabled {
368
- color: #ffffff !important;
369
- border-color: $u-type-primary-disabled !important;
370
- background-color: $u-type-primary-disabled !important;
371
- }
372
-
373
- &--success--disabled {
374
- color: #ffffff !important;
375
- border-color: $u-type-success-disabled !important;
376
- background-color: $u-type-success-disabled !important;
377
- }
378
-
379
- &--error--disabled {
380
- color: #ffffff !important;
381
- border-color: $u-type-error-disabled !important;
382
- background-color: $u-type-error-disabled !important;
383
- }
384
-
385
- &--warning--disabled {
386
- color: #ffffff !important;
387
- border-color: $u-type-warning-disabled !important;
388
- background-color: $u-type-warning-disabled !important;
389
- }
390
-
391
- &--primary--plain {
392
- color: $u-type-primary !important;
393
- border-color: $u-type-primary-disabled !important;
394
- background-color: $u-type-primary-light !important;
395
- }
396
-
397
- &--success--plain {
398
- color: $u-type-success !important;
399
- border-color: $u-type-success-disabled !important;
400
- background-color: $u-type-success-light !important;
401
- }
402
-
403
- &--error--plain {
404
- color: $u-type-error !important;
405
- border-color: $u-type-error-disabled !important;
406
- background-color: $u-type-error-light !important;
407
- }
408
-
409
- &--warning--plain {
410
- color: $u-type-warning !important;
411
- border-color: $u-type-warning-disabled !important;
412
- background-color: $u-type-warning-light !important;
413
- }
414
- }
415
-
416
- .u-hairline-border:after {
417
- content: ' ';
418
- position: absolute;
419
- pointer-events: none;
420
- // 设置为border-box,意味着下面的scale缩小为0.5,实际上缩小的是伪元素的内容(border-box意味着内容不含border)
421
- box-sizing: border-box;
422
- // 中心点作为变形(scale())的原点
423
- -webkit-transform-origin: 0 0;
424
- transform-origin: 0 0;
425
- left: 0;
426
- top: 0;
427
- width: 199.8%;
428
- height: 199.7%;
429
- -webkit-transform: scale(0.5, 0.5);
430
- transform: scale(0.5, 0.5);
431
- border: 1px solid currentColor;
432
- z-index: 1;
433
- }
434
-
435
- .u-wave-ripple {
436
- z-index: 0;
437
- position: absolute;
438
- border-radius: 100%;
439
- background-clip: padding-box;
440
- pointer-events: none;
441
- user-select: none;
442
- transform: scale(0);
443
- opacity: 1;
444
- transform-origin: center;
445
- }
446
-
447
- .u-wave-ripple.u-wave-active {
448
- opacity: 0;
449
- transform: scale(2);
450
- transition: opacity 1s linear, transform 0.4s linear;
451
- }
452
-
453
- .u-round-circle {
454
- border-radius: 100rpx;
455
- }
456
-
457
- .u-round-circle::after {
458
- border-radius: 100rpx;
459
- }
460
-
461
- .u-loading::after {
462
- background-color: hsla(0, 0%, 100%, 0.35);
463
- }
464
-
465
- .u-size-default {
466
- font-size: 30rpx;
467
- height: 80rpx;
468
- line-height: 80rpx;
469
- }
470
-
471
- .u-size-medium {
472
- /* #ifndef APP-NVUE */
473
- display: inline-flex;
474
- /* #endif */
475
- width: auto;
476
- font-size: 26rpx;
477
- height: 70rpx;
478
- line-height: 70rpx;
479
- padding: 0 80rpx;
480
- }
481
-
482
- .u-size-mini {
483
- /* #ifndef APP-NVUE */
484
- display: inline-flex;
485
- /* #endif */
486
- width: auto;
487
- font-size: 22rpx;
488
- padding-top: 1px;
489
- height: 50rpx;
490
- line-height: 50rpx;
491
- padding: 0 20rpx;
492
- }
493
-
494
- .u-primary-plain-hover {
495
- color: #ffffff !important;
496
- background: $u-type-primary-dark !important;
497
- }
498
-
499
- .u-default-plain-hover {
500
- color: $u-type-primary-dark !important;
501
- background: $u-type-primary-light !important;
502
- }
503
-
504
- .u-success-plain-hover {
505
- color: #ffffff !important;
506
- background: $u-type-success-dark !important;
507
- }
508
-
509
- .u-warning-plain-hover {
510
- color: #ffffff !important;
511
- background: $u-type-warning-dark !important;
512
- }
513
-
514
- .u-error-plain-hover {
515
- color: #ffffff !important;
516
- background: $u-type-error-dark !important;
517
- }
518
-
519
- .u-info-plain-hover {
520
- color: #ffffff !important;
521
- background: $u-type-info-dark !important;
522
- }
523
-
524
- .u-default-hover {
525
- color: $u-type-primary-dark !important;
526
- border-color: $u-type-primary-dark !important;
527
- background-color: $u-type-primary-light !important;
528
- }
529
-
530
- .u-primary-hover {
531
- background: $u-type-primary-dark !important;
532
- color: #fff;
533
- }
534
-
535
- .u-success-hover {
536
- background: $u-type-success-dark !important;
537
- color: #fff;
538
- }
539
-
540
- .u-info-hover {
541
- background: $u-type-info-dark !important;
542
- color: #fff;
543
- }
544
-
545
- .u-warning-hover {
546
- background: $u-type-warning-dark !important;
547
- color: #fff;
548
- }
549
-
550
- .u-error-hover {
551
- background: $u-type-error-dark !important;
552
- color: #fff;
553
- }
554
- </style>
1
+ <template>
2
+ <button
3
+ id="u-wave-btn"
4
+ class="u-btn u-line-1 u-fix-ios-appearance"
5
+ :class="[
6
+ 'u-size-' + size,
7
+ plain ? 'u-btn--' + type + '--plain' : '',
8
+ loading ? 'u-loading' : '',
9
+ shape === 'circle' ? 'u-round-circle' : '',
10
+ hairLine ? showHairLineBorder : 'u-btn--bold-border',
11
+ 'u-btn--' + type,
12
+ disabled ? `u-btn--${type}--disabled` : ''
13
+ ]"
14
+ :hover-start-time="Number(hoverStartTime)"
15
+ :hover-stay-time="Number(hoverStayTime)"
16
+ :disabled="disabled"
17
+ :form-type="formType"
18
+ :open-type="disabled || loading ? undefined : openType"
19
+ :app-parameter="appParameter"
20
+ :hover-stop-propagation="hoverStopPropagation"
21
+ :send-message-title="sendMessageTitle"
22
+ send-message-path="sendMessagePath"
23
+ :lang="lang"
24
+ :data-name="dataName"
25
+ :session-from="sessionFrom"
26
+ :send-message-img="sendMessageImg"
27
+ :show-message-card="showMessageCard"
28
+ @getAuthorize="getAuthorize"
29
+ @getuserinfo="getuserinfo"
30
+ @contact="contact"
31
+ @getphonenumber="getphonenumber"
32
+ @error="error"
33
+ @launchapp="launchapp"
34
+ @opensetting="opensetting"
35
+ @chooseavatar="chooseavatar"
36
+ @agreeprivacyauthorization="agreeprivacyauthorization"
37
+ :style="[
38
+ customStyle,
39
+ {
40
+ overflow: ripple ? 'hidden' : 'visible'
41
+ }
42
+ ]"
43
+ @tap.stop="click($event)"
44
+ :hover-class="getHoverClass"
45
+ :loading="loading"
46
+ >
47
+ <slot></slot>
48
+ <view
49
+ v-if="ripple"
50
+ class="u-wave-ripple"
51
+ :class="[waveActive ? 'u-wave-active' : '']"
52
+ :style="{
53
+ top: rippleTop + 'px',
54
+ left: rippleLeft + 'px',
55
+ width: fields.targetWidth + 'px',
56
+ height: fields.targetWidth + 'px',
57
+ 'background-color': rippleBgColor || 'rgba(0, 0, 0, 0.15)'
58
+ }"
59
+ ></view>
60
+ </button>
61
+ </template>
62
+
63
+ <script setup lang="ts">
64
+ import { ref, computed, nextTick } from 'vue';
65
+ import { $u } from '../../';
66
+ import { ButtonProps } from './types';
67
+
68
+ defineOptions({
69
+ name: 'u-button'
70
+ });
71
+ /**
72
+ * button 按钮
73
+ * @description Button 按钮
74
+ * @tutorial https://uview-pro.netlify.app/components/button.html
75
+ * @property {String} size 按钮的大小
76
+ * @property {Boolean} ripple 是否开启点击水波纹效果
77
+ * @property {String} ripple-bg-color 水波纹的背景色,ripple为true时有效
78
+ * @property {String} type 按钮的样式类型
79
+ * @property {Boolean} plain 按钮是否镂空,背景色透明
80
+ * @property {Boolean} disabled 是否禁用
81
+ * @property {Boolean} hair-line 是否显示按钮的细边框(默认true)
82
+ * @property {String} shape 按钮外观形状,见文档说明
83
+ * @property {Boolean} loading 按钮名称前是否带 loading 图标(App-nvue 平台,在 ios 上为雪花,Android上为圆圈)
84
+ * @property {String} form-type 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件
85
+ * @property {String} open-type 开放能力
86
+ * @property {String} data-name 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取
87
+ * @property {String} hover-class 指定按钮按下去的样式类。当 hover-class="none" 时,没有点击态效果(App-nvue 平台暂不支持)
88
+ * @property {Number} hover-start-time 按住后多久出现点击态,单位毫秒
89
+ * @property {Number} hover-stay-time 手指松开后点击态保留时间,单位毫秒
90
+ * @property {Object} custom-style 对按钮的自定义样式,对象形式,见文档说明
91
+ * @property {String} app-parameter 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效
92
+ * @property {Boolean} hover-stop-propagation 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效
93
+ * @property {String} lang 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。只微信小程序有效
94
+ * @property {String} session-from 会话来源,open-type="contact"时有效。只微信小程序有效
95
+ * @property {String} send-message-title 会话内消息卡片标题,open-type="contact"时有效
96
+ * @property {String} send-message-path 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效
97
+ * @property {String} send-message-img 会话内消息卡片图片,open-type="contact"时有效
98
+ * @property {Boolean} show-message-card 是否显示会话内消息卡片,open-type="contact"时有效
99
+ * @property {Number|String} throttle-time 节流,一定时间内只能触发一次,单位毫秒
100
+ * @property {String} scope 支付宝小程序,当 open-type 为 getAuthorize 时有效。可选值:'phoneNumber' | 'userInfo'
101
+ * @event {Function} click 按钮点击
102
+ * @event {Function} getphonenumber open-type="getPhoneNumber"时有效
103
+ * @event {Function} getuserinfo 用户点击该按钮时,会返回获取到的用户信息,从返回参数的detail中获取到的值同uni.getUserInfo
104
+ * @event {Function} error 当使用开放能力时,发生错误的回调
105
+ * @event {Function} opensetting 在打开授权设置页并关闭后回调
106
+ * @event {Function} launchapp 打开 APP 成功的回调
107
+ * @event {Function} contact 客服消息回调
108
+ * @event {Function} chooseavatar 头像选择回调
109
+ * @event {Function} agreeprivacyauthorization 用户点击允许授权回调
110
+ * @example <u-button>月落</u-button>
111
+ */
112
+
113
+ const emit = defineEmits(['click', 'getuserinfo', 'contact', 'getphonenumber', 'error', 'launchapp', 'opensetting', 'chooseavatar', 'agreeprivacyauthorization']);
114
+
115
+ const props = defineProps(ButtonProps);
116
+
117
+ /**
118
+ * 按钮水波纹相关状态
119
+ */
120
+ const rippleTop = ref(0); // 水波纹的起点Y坐标到按钮上边界的距离
121
+ const rippleLeft = ref(0); // 水波纹起点X坐标到按钮左边界的距离
122
+ const fields = ref<Record<string, any>>({}); // 波纹按钮节点信息
123
+ const waveActive = ref(false); // 激活水波纹
124
+
125
+ /**
126
+ * 当没有传bgColor变量时,按钮按下去的颜色类名
127
+ * @returns {string}
128
+ */
129
+ const getHoverClass = computed(() => {
130
+ // 如果开启水波纹效果,则不启用hover-class效果
131
+ if (props.loading || props.disabled || props.ripple || props.hoverClass) return '';
132
+ let hoverClass = '';
133
+ hoverClass = props.plain ? 'u-' + props.type + '-plain-hover' : 'u-' + props.type + '-hover';
134
+ return hoverClass;
135
+ });
136
+
137
+ /**
138
+ * 在'primary', 'success', 'error', 'warning'类型下,不显示边框,否则会造成四角有毛刺现象
139
+ * @returns {string}
140
+ */
141
+ const showHairLineBorder = computed(() => {
142
+ if (['primary', 'success', 'error', 'warning'].indexOf(props.type) >= 0 && !props.plain) {
143
+ return '';
144
+ } else {
145
+ return 'u-hairline-border';
146
+ }
147
+ });
148
+
149
+ /**
150
+ * 按钮点击
151
+ * @param e 事件对象
152
+ * @emits click
153
+ */
154
+ function click(e: any) {
155
+ $u.throttle(() => {
156
+ // 如果按钮时disabled和loading状态,不触发水波纹效果
157
+ if (props.loading === true || props.disabled === true) return;
158
+ // 是否开启水波纹效果
159
+ if (props.ripple) {
160
+ // 每次点击时,移除上一次的类,再次添加,才能触发动画效果
161
+ waveActive.value = false;
162
+ nextTick(() => {
163
+ getWaveQuery(e);
164
+ });
165
+ }
166
+ emit('click', e);
167
+ }, Number(props.throttleTime));
168
+ }
169
+
170
+ /**
171
+ * 查询按钮的节点信息
172
+ * @param e 事件对象
173
+ */
174
+ function getWaveQuery(e: any) {
175
+ getElQuery().then((res: any[]) => {
176
+ // 查询返回的是一个数组节点
177
+ let data = res[0];
178
+ // 查询不到节点信息,不操作
179
+ if (!data.width || !data.width) return;
180
+ // 水波纹的最终形态是一个正方形(通过border-radius让其变为一个圆形),这里要保证正方形的边长等于按钮的最长边
181
+ // 最终的方形(变换后的圆形)才能覆盖整个按钮
182
+ data.targetWidth = data.height > data.width ? data.height : data.width;
183
+ if (!data.targetWidth) return;
184
+ fields.value = data;
185
+ let touchesX = '',
186
+ touchesY = '';
187
+ // #ifdef MP-BAIDU
188
+ // @ts-ignore
189
+ touchesX = e.changedTouches[0].clientX;
190
+ touchesY = e.changedTouches[0].clientY;
191
+ // #endif
192
+ // #ifdef MP-ALIPAY
193
+ // @ts-ignore
194
+ touchesX = e.detail.clientX;
195
+ touchesY = e.detail.clientY;
196
+ // #endif
197
+ // #ifndef MP-BAIDU || MP-ALIPAY
198
+ // @ts-ignore
199
+ touchesX = e.touches[0].clientX;
200
+ touchesY = e.touches[0].clientY;
201
+ // #endif
202
+ // 获取触摸点相对于按钮上边和左边的x和y坐标,原理是通过屏幕的触摸点(touchesY),减去按钮的上边界data.top
203
+ // 但是由于`transform-origin`默认是center,所以这里再减去半径才是水波纹view应该的位置
204
+ // 总的来说,就是把水波纹的矩形(变换后的圆形)的中心点,移动到我们的触摸点位置
205
+ rippleTop.value = Number(touchesY) - data.top - data.targetWidth / 2;
206
+ rippleLeft.value = Number(touchesX) - data.left - data.targetWidth / 2;
207
+ nextTick(() => {
208
+ waveActive.value = true;
209
+ });
210
+ });
211
+ }
212
+
213
+ /**
214
+ * 获取节点信息
215
+ * @returns {Promise<any[]>}
216
+ */
217
+ function getElQuery(): Promise<any[]> {
218
+ return new Promise(resolve => {
219
+ let queryInfo: any = '';
220
+ // 获取元素节点信息,请查看uniapp相关文档
221
+ // https://uniapp.dcloud.io/api/ui/nodes-info?id=nodesrefboundingclientrect
222
+ // @ts-ignore
223
+ queryInfo = uni.createSelectorQuery().in(null);
224
+ // #ifdef MP-ALIPAY
225
+ // @ts-ignore
226
+ queryInfo = uni.createSelectorQuery();
227
+ // #endif
228
+ queryInfo.select('.u-btn').boundingClientRect();
229
+ queryInfo.exec((data: any) => {
230
+ resolve(data);
231
+ });
232
+ });
233
+ }
234
+
235
+ // 下面为对接uniapp官方按钮开放能力事件回调的对接
236
+ /**
237
+ * open-type="getPhoneNumber"时有效
238
+ */
239
+ function getphonenumber(event: any) {
240
+ emit('getphonenumber', event);
241
+ }
242
+ /**
243
+ * 用户点击该按钮时,会返回获取到的用户信息,从返回参数的detail中获取到的值同uni.getUserInfo
244
+ */
245
+ function getuserinfo(event: any) {
246
+ emit('getuserinfo', event);
247
+ }
248
+ /**
249
+ * 当使用开放能力时,发生错误的回调
250
+ */
251
+ function error(event: any) {
252
+ emit('error', event);
253
+ }
254
+ /**
255
+ * 在打开授权设置页并关闭后回调
256
+ */
257
+ function opensetting(event: any) {
258
+ emit('opensetting', event);
259
+ }
260
+ /**
261
+ * 打开 APP 成功的回调
262
+ */
263
+ function launchapp(event: any) {
264
+ emit('launchapp', event);
265
+ }
266
+
267
+ /**
268
+ * 支付宝小程序授权
269
+ * @param event
270
+ */
271
+ function getAuthorize(event: any) {
272
+ if (props.scope === 'phoneNumber') {
273
+ getphonenumber(event);
274
+ } else if (props.scope === 'userInfo') {
275
+ getuserinfo(event);
276
+ }
277
+ }
278
+
279
+ /**
280
+ * 客服消息回调
281
+ * @param event
282
+ */
283
+ function contact(event: any) {
284
+ emit('contact', event);
285
+ }
286
+ /**
287
+ * 头像选择回调
288
+ * @param event
289
+ */
290
+ function chooseavatar(event: any) {
291
+ emit('chooseavatar', event);
292
+ }
293
+ /**
294
+ * 用户点击允许授权回调
295
+ * @param event
296
+ */
297
+ function agreeprivacyauthorization(event: any) {
298
+ emit('agreeprivacyauthorization', event);
299
+ }
300
+ </script>
301
+
302
+ <style scoped lang="scss">
303
+ @import '../../libs/css/style.components.scss';
304
+ .u-btn::after {
305
+ border: none;
306
+ }
307
+
308
+ .u-btn {
309
+ position: relative;
310
+ border: 0;
311
+ //border-radius: 10rpx;
312
+ /* #ifndef APP-NVUE */
313
+ display: inline-flex;
314
+ /* #endif */
315
+ // 避免边框某些场景可能被“裁剪”,不能设置为hidden
316
+ overflow: visible;
317
+ line-height: 1;
318
+ @include vue-flex;
319
+ align-items: center;
320
+ justify-content: center;
321
+ cursor: pointer;
322
+ padding: 0 40rpx;
323
+ z-index: 1;
324
+ box-sizing: border-box;
325
+ transition: all 0.15s;
326
+
327
+ &--bold-border {
328
+ border: 1px solid #ffffff;
329
+ }
330
+
331
+ &--default {
332
+ color: $u-content-color;
333
+ border-color: #c0c4cc;
334
+ background-color: #ffffff;
335
+ }
336
+
337
+ &--primary {
338
+ color: #ffffff;
339
+ border-color: $u-type-primary;
340
+ background-color: $u-type-primary;
341
+ }
342
+
343
+ &--success {
344
+ color: #ffffff;
345
+ border-color: $u-type-success;
346
+ background-color: $u-type-success;
347
+ }
348
+
349
+ &--error {
350
+ color: #ffffff;
351
+ border-color: $u-type-error;
352
+ background-color: $u-type-error;
353
+ }
354
+
355
+ &--warning {
356
+ color: #ffffff;
357
+ border-color: $u-type-warning;
358
+ background-color: $u-type-warning;
359
+ }
360
+
361
+ &--default--disabled {
362
+ color: #ffffff;
363
+ border-color: #e4e7ed;
364
+ background-color: #ffffff;
365
+ }
366
+
367
+ &--primary--disabled {
368
+ color: #ffffff !important;
369
+ border-color: $u-type-primary-disabled !important;
370
+ background-color: $u-type-primary-disabled !important;
371
+ }
372
+
373
+ &--success--disabled {
374
+ color: #ffffff !important;
375
+ border-color: $u-type-success-disabled !important;
376
+ background-color: $u-type-success-disabled !important;
377
+ }
378
+
379
+ &--error--disabled {
380
+ color: #ffffff !important;
381
+ border-color: $u-type-error-disabled !important;
382
+ background-color: $u-type-error-disabled !important;
383
+ }
384
+
385
+ &--warning--disabled {
386
+ color: #ffffff !important;
387
+ border-color: $u-type-warning-disabled !important;
388
+ background-color: $u-type-warning-disabled !important;
389
+ }
390
+
391
+ &--primary--plain {
392
+ color: $u-type-primary !important;
393
+ border-color: $u-type-primary-disabled !important;
394
+ background-color: $u-type-primary-light !important;
395
+ }
396
+
397
+ &--success--plain {
398
+ color: $u-type-success !important;
399
+ border-color: $u-type-success-disabled !important;
400
+ background-color: $u-type-success-light !important;
401
+ }
402
+
403
+ &--error--plain {
404
+ color: $u-type-error !important;
405
+ border-color: $u-type-error-disabled !important;
406
+ background-color: $u-type-error-light !important;
407
+ }
408
+
409
+ &--warning--plain {
410
+ color: $u-type-warning !important;
411
+ border-color: $u-type-warning-disabled !important;
412
+ background-color: $u-type-warning-light !important;
413
+ }
414
+ }
415
+
416
+ .u-hairline-border:after {
417
+ content: ' ';
418
+ position: absolute;
419
+ pointer-events: none;
420
+ // 设置为border-box,意味着下面的scale缩小为0.5,实际上缩小的是伪元素的内容(border-box意味着内容不含border)
421
+ box-sizing: border-box;
422
+ // 中心点作为变形(scale())的原点
423
+ -webkit-transform-origin: 0 0;
424
+ transform-origin: 0 0;
425
+ left: 0;
426
+ top: 0;
427
+ width: 199.8%;
428
+ height: 199.7%;
429
+ -webkit-transform: scale(0.5, 0.5);
430
+ transform: scale(0.5, 0.5);
431
+ border: 1px solid currentColor;
432
+ z-index: 1;
433
+ }
434
+
435
+ .u-wave-ripple {
436
+ z-index: 0;
437
+ position: absolute;
438
+ border-radius: 100%;
439
+ background-clip: padding-box;
440
+ pointer-events: none;
441
+ user-select: none;
442
+ transform: scale(0);
443
+ opacity: 1;
444
+ transform-origin: center;
445
+ }
446
+
447
+ .u-wave-ripple.u-wave-active {
448
+ opacity: 0;
449
+ transform: scale(2);
450
+ transition: opacity 1s linear, transform 0.4s linear;
451
+ }
452
+
453
+ .u-round-circle {
454
+ border-radius: 100rpx;
455
+ }
456
+
457
+ .u-round-circle::after {
458
+ border-radius: 100rpx;
459
+ }
460
+
461
+ .u-loading::after {
462
+ background-color: hsla(0, 0%, 100%, 0.35);
463
+ }
464
+
465
+ .u-size-default {
466
+ font-size: 30rpx;
467
+ height: 80rpx;
468
+ line-height: 80rpx;
469
+ }
470
+
471
+ .u-size-medium {
472
+ /* #ifndef APP-NVUE */
473
+ display: inline-flex;
474
+ /* #endif */
475
+ width: auto;
476
+ font-size: 26rpx;
477
+ height: 70rpx;
478
+ line-height: 70rpx;
479
+ padding: 0 80rpx;
480
+ }
481
+
482
+ .u-size-mini {
483
+ /* #ifndef APP-NVUE */
484
+ display: inline-flex;
485
+ /* #endif */
486
+ width: auto;
487
+ font-size: 22rpx;
488
+ padding-top: 1px;
489
+ height: 50rpx;
490
+ line-height: 50rpx;
491
+ padding: 0 20rpx;
492
+ }
493
+
494
+ .u-primary-plain-hover {
495
+ color: #ffffff !important;
496
+ background: $u-type-primary-dark !important;
497
+ }
498
+
499
+ .u-default-plain-hover {
500
+ color: $u-type-primary-dark !important;
501
+ background: $u-type-primary-light !important;
502
+ }
503
+
504
+ .u-success-plain-hover {
505
+ color: #ffffff !important;
506
+ background: $u-type-success-dark !important;
507
+ }
508
+
509
+ .u-warning-plain-hover {
510
+ color: #ffffff !important;
511
+ background: $u-type-warning-dark !important;
512
+ }
513
+
514
+ .u-error-plain-hover {
515
+ color: #ffffff !important;
516
+ background: $u-type-error-dark !important;
517
+ }
518
+
519
+ .u-info-plain-hover {
520
+ color: #ffffff !important;
521
+ background: $u-type-info-dark !important;
522
+ }
523
+
524
+ .u-default-hover {
525
+ color: $u-type-primary-dark !important;
526
+ border-color: $u-type-primary-dark !important;
527
+ background-color: $u-type-primary-light !important;
528
+ }
529
+
530
+ .u-primary-hover {
531
+ background: $u-type-primary-dark !important;
532
+ color: #fff;
533
+ }
534
+
535
+ .u-success-hover {
536
+ background: $u-type-success-dark !important;
537
+ color: #fff;
538
+ }
539
+
540
+ .u-info-hover {
541
+ background: $u-type-info-dark !important;
542
+ color: #fff;
543
+ }
544
+
545
+ .u-warning-hover {
546
+ background: $u-type-warning-dark !important;
547
+ color: #fff;
548
+ }
549
+
550
+ .u-error-hover {
551
+ background: $u-type-error-dark !important;
552
+ color: #fff;
553
+ }
554
+ </style>