hy-app 0.6.4 → 0.6.6
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.
- package/attributes.json +1 -1
- package/components/hy-address-picker/hy-address-picker.vue +249 -249
- package/components/hy-address-picker/props.ts +103 -103
- package/components/hy-button/hy-button.vue +320 -289
- package/components/hy-button/props.ts +143 -143
- package/components/hy-button/typing.d.ts +43 -35
- package/components/hy-calendar/header.vue +58 -58
- package/components/hy-calendar/hy-calendar.vue +8 -6
- package/components/hy-calendar/month.vue +402 -402
- package/components/hy-calendar/props.ts +169 -169
- package/components/hy-calendar/typing.d.ts +47 -45
- package/components/hy-cell-item/hy-cell-item.vue +161 -161
- package/components/hy-cell-item/props.ts +59 -59
- package/components/hy-check-button/hy-check-button.vue +135 -135
- package/components/hy-code-input/hy-code-input.vue +231 -231
- package/components/hy-code-input/props.ts +90 -90
- package/components/hy-config-provider/hy-config-provider.vue +53 -53
- package/components/hy-config-provider/props.ts +30 -30
- package/components/hy-coupon/hy-coupon.vue +183 -183
- package/components/hy-coupon/props.ts +108 -108
- package/components/hy-datetime-picker/hy-datetime-picker.vue +41 -55
- package/components/hy-datetime-picker/props.ts +144 -144
- package/components/hy-datetime-picker/typing.d.ts +2 -0
- package/components/hy-divider/props.ts +83 -83
- package/components/hy-empty/icon.ts +72 -72
- package/components/hy-folding-panel/hy-folding-panel-group.vue +162 -162
- package/components/hy-form/hy-form.vue +220 -220
- package/components/hy-icon/hy-icon.vue +112 -112
- package/components/hy-index-bar/hy-index-bar.vue +185 -185
- package/components/hy-index-bar/index.scss +64 -64
- package/components/hy-index-bar/props.ts +94 -94
- package/components/hy-index-bar/typing.d.ts +36 -36
- package/components/hy-input/hy-input.vue +333 -333
- package/components/hy-input/props.ts +186 -186
- package/components/hy-modal/hy-modal.vue +211 -211
- package/components/hy-modal/props.ts +94 -94
- package/components/hy-modal/typing.d.ts +16 -16
- package/components/hy-notice-bar/hy-row-notice.vue +121 -121
- package/components/hy-notify/hy-notify.vue +174 -174
- package/components/hy-number-step/hy-number-step.vue +367 -367
- package/components/hy-overlay/hy-overlay.vue +61 -61
- package/components/hy-overlay/props.ts +38 -38
- package/components/hy-pagination/hy-pagination.vue +136 -136
- package/components/hy-pagination/props.ts +58 -58
- package/components/hy-parse/hy-parse.vue +550 -550
- package/components/hy-parse/node/node.vue +781 -781
- package/components/hy-parse/parser.js +1455 -1455
- package/components/hy-parse/props.ts +19 -19
- package/components/hy-parse/typing.d.ts +68 -68
- package/components/hy-picker/hy-picker.vue +435 -435
- package/components/hy-picker/props.ts +122 -122
- package/components/hy-picker/typing.d.ts +38 -38
- package/components/hy-qrcode/props.ts +72 -72
- package/components/hy-qrcode/qrcode.js.bak +1433 -1433
- package/components/hy-radio/props.ts +97 -97
- package/components/hy-read-more/props.ts +48 -48
- package/components/hy-search/props.ts +133 -133
- package/components/hy-signature/canvasHelper.ts +51 -51
- package/components/hy-signature/props.ts +121 -121
- package/components/hy-skeleton/hy-skeleton.vue +142 -142
- package/components/hy-skeleton/props.ts +46 -46
- package/components/hy-skeleton/typing.d.ts +31 -31
- package/components/hy-steps/hy-steps.vue +275 -275
- package/components/hy-steps/typing.d.ts +25 -25
- package/components/hy-swiper/hy-swiper.vue +3 -3
- package/components/hy-swiper/index.scss +5 -5
- package/components/hy-swiper/props.ts +0 -1
- package/components/hy-table/hy-table.vue +630 -630
- package/components/hy-table/props.ts +62 -62
- package/components/hy-table/typing.d.ts +29 -29
- package/components/hy-tabs/hy-tabs.vue +336 -335
- package/components/hy-tabs/props.ts +84 -77
- package/components/hy-tag/hy-tag.vue +173 -173
- package/components/hy-tag/props.ts +89 -89
- package/components/hy-text/hy-text.vue +237 -237
- package/components/hy-text/props.ts +115 -115
- package/components/hy-textarea/hy-textarea.vue +198 -198
- package/components/hy-toast/hy-toast.vue +200 -200
- package/components/hy-toast/props.ts +3 -3
- package/components/hy-transition/hy-transition.vue +157 -157
- package/components/hy-transition/props.ts +32 -32
- package/components/hy-upload/hy-upload.vue +384 -384
- package/components/hy-watermark/hy-watermark.vue +1058 -1058
- package/components/hy-watermark/props.ts +109 -109
- package/global.d.ts +94 -94
- package/libs/api/http.ts +119 -119
- package/libs/composables/index.ts +8 -8
- package/libs/composables/useMessage.ts +149 -149
- package/libs/composables/useToast.ts +45 -45
- package/libs/composables/useTranslate.ts +10 -10
- package/libs/css/_config.scss +5 -5
- package/libs/index.ts +8 -8
- package/libs/locale/index.ts +32 -32
- package/libs/locale/lang/en-US.ts +84 -84
- package/libs/locale/lang/zh-CN.ts +87 -87
- package/libs/typing/index.ts +2 -2
- package/libs/typing/modules/common.d.ts +139 -139
- package/libs/typing/modules/form.ts +176 -176
- package/libs/typing/modules/http.d.ts +19 -19
- package/libs/typing/modules/index.d.ts +12 -12
- package/libs/utils/inside.ts +340 -340
- package/libs/utils/inspect.ts +140 -140
- package/libs/utils/utils.ts +525 -525
- package/package.json +81 -81
- package/tags.json +1 -1
- package/web-types.json +1 -1
|
@@ -1,289 +1,320 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- #ifndef APP-NVUE -->
|
|
3
|
-
<button
|
|
4
|
-
:hover-start-time="Number(hoverStartTime)"
|
|
5
|
-
:hover-stay-time="Number(hoverStayTime)"
|
|
6
|
-
:form-type="formType"
|
|
7
|
-
:open-type="openType"
|
|
8
|
-
:lang="lang"
|
|
9
|
-
:scope="scope"
|
|
10
|
-
:data-name="dataName"
|
|
11
|
-
:app-parameter="appParameter"
|
|
12
|
-
:hover-stop-propagation="hoverStopPropagation"
|
|
13
|
-
:send-message-title="sendMessageTitle"
|
|
14
|
-
:send-message-path="sendMessagePath"
|
|
15
|
-
:session-from="sessionFrom"
|
|
16
|
-
:send-message-img="sendMessageImg"
|
|
17
|
-
:show-message-card="showMessageCard"
|
|
18
|
-
@getphonenumber="getphonenumber"
|
|
19
|
-
@getuserinfo="getuserinfo"
|
|
20
|
-
@getAuthorize="getAuthorize"
|
|
21
|
-
@
|
|
22
|
-
@
|
|
23
|
-
@
|
|
24
|
-
@
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
:
|
|
42
|
-
:
|
|
43
|
-
:
|
|
44
|
-
:
|
|
45
|
-
:
|
|
46
|
-
:
|
|
47
|
-
:
|
|
48
|
-
:
|
|
49
|
-
:
|
|
50
|
-
:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<!-- #
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
:hover-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
:
|
|
93
|
-
:
|
|
94
|
-
:
|
|
95
|
-
:
|
|
96
|
-
:
|
|
97
|
-
:
|
|
98
|
-
:
|
|
99
|
-
:
|
|
100
|
-
:
|
|
101
|
-
:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
</
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
import {
|
|
135
|
-
import type {
|
|
136
|
-
import
|
|
137
|
-
|
|
138
|
-
import
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return '
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
//
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
style.
|
|
201
|
-
style.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
style.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
if (props.size === '
|
|
239
|
-
if (props.size === '
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<!-- #ifndef APP-NVUE -->
|
|
3
|
+
<button
|
|
4
|
+
:hover-start-time="Number(hoverStartTime)"
|
|
5
|
+
:hover-stay-time="Number(hoverStayTime)"
|
|
6
|
+
:form-type="formType"
|
|
7
|
+
:open-type="openType"
|
|
8
|
+
:lang="lang"
|
|
9
|
+
:scope="scope"
|
|
10
|
+
:data-name="dataName"
|
|
11
|
+
:app-parameter="appParameter"
|
|
12
|
+
:hover-stop-propagation="hoverStopPropagation"
|
|
13
|
+
:send-message-title="sendMessageTitle"
|
|
14
|
+
:send-message-path="sendMessagePath"
|
|
15
|
+
:session-from="sessionFrom"
|
|
16
|
+
:send-message-img="sendMessageImg"
|
|
17
|
+
:show-message-card="showMessageCard"
|
|
18
|
+
@getphonenumber="getphonenumber"
|
|
19
|
+
@getuserinfo="getuserinfo"
|
|
20
|
+
@getAuthorize="getAuthorize"
|
|
21
|
+
@chooseavatar="chooseavatar"
|
|
22
|
+
@error="error"
|
|
23
|
+
@contact="contact"
|
|
24
|
+
@opensetting="opensetting"
|
|
25
|
+
@launchapp="launchapp"
|
|
26
|
+
@agreeprivacyauthorization="agreeprivacyauthorization"
|
|
27
|
+
:hover-class="!disabled && !loading ? 'hy-button--active' : ''"
|
|
28
|
+
:style="[baseColor, customStyle]"
|
|
29
|
+
@click="clickHandler"
|
|
30
|
+
:class="['hy-button', !border && 'hy-button__no-border', bemClass, customClass]"
|
|
31
|
+
>
|
|
32
|
+
<template v-if="loading">
|
|
33
|
+
<hy-loading :mode="loadingMode" :size="loadingSize" :color="loadingColor"></hy-loading>
|
|
34
|
+
<text class="hy-button__loading-text" :style="[{ fontSize: textSize + 'px' }]">
|
|
35
|
+
{{ loadingText || text }}
|
|
36
|
+
</text>
|
|
37
|
+
</template>
|
|
38
|
+
<template v-else>
|
|
39
|
+
<hy-icon
|
|
40
|
+
v-if="icon?.name"
|
|
41
|
+
:name="icon?.name"
|
|
42
|
+
:color="iconColorCom"
|
|
43
|
+
:size="icon?.size || textSize * 1.35"
|
|
44
|
+
:bold="icon?.bold"
|
|
45
|
+
:customPrefix="icon?.customPrefix"
|
|
46
|
+
:imgMode="icon?.imgMode"
|
|
47
|
+
:width="icon?.width"
|
|
48
|
+
:height="icon?.height"
|
|
49
|
+
:top="icon?.top"
|
|
50
|
+
:stop="icon?.stop"
|
|
51
|
+
:round="icon?.round"
|
|
52
|
+
:customStyle="icon?.customStyle || { marginRight: '2px' }"
|
|
53
|
+
></hy-icon>
|
|
54
|
+
<!-- @slot 插入默认的值 -->
|
|
55
|
+
<slot v-if="$slots.default"></slot>
|
|
56
|
+
<text v-else class="hy-button__text" :style="[{ fontSize: textSize + 'px' }]">{{
|
|
57
|
+
text
|
|
58
|
+
}}</text>
|
|
59
|
+
</template>
|
|
60
|
+
</button>
|
|
61
|
+
<!-- #endif -->
|
|
62
|
+
|
|
63
|
+
<!-- #ifdef APP-NVUE -->
|
|
64
|
+
<view
|
|
65
|
+
:hover-start-time="Number(hoverStartTime)"
|
|
66
|
+
:hover-stay-time="Number(hoverStayTime)"
|
|
67
|
+
class="hy-button"
|
|
68
|
+
:hover-class="
|
|
69
|
+
!disabled && !loading && !color && (plain || type === 'info')
|
|
70
|
+
? 'hy-button--active--plain'
|
|
71
|
+
: !disabled && !loading && !plain
|
|
72
|
+
? 'hy-button--active'
|
|
73
|
+
: ''
|
|
74
|
+
"
|
|
75
|
+
@click="clickHandler"
|
|
76
|
+
:class="bemClass"
|
|
77
|
+
:style="[baseColor, customStyle]"
|
|
78
|
+
>
|
|
79
|
+
<template v-if="loading">
|
|
80
|
+
<hy-loading :mode="loadingMode" :size="loadingSize" :color="loadingColor"></hy-loading>
|
|
81
|
+
<text
|
|
82
|
+
class="hy-button__loading-text"
|
|
83
|
+
:style="[nvueTextStyle]"
|
|
84
|
+
:class="[plain && `hy-button__text--plain--${type}`]"
|
|
85
|
+
>
|
|
86
|
+
{{ loadingText || text }}
|
|
87
|
+
</text>
|
|
88
|
+
</template>
|
|
89
|
+
<template v-else>
|
|
90
|
+
<hy-icon
|
|
91
|
+
v-if="icon?.name"
|
|
92
|
+
:name="icon?.name"
|
|
93
|
+
:color="iconColorCom"
|
|
94
|
+
:size="icon?.size || textSize * 1.35"
|
|
95
|
+
:bold="icon?.bold"
|
|
96
|
+
:customPrefix="icon?.customPrefix"
|
|
97
|
+
:imgMode="icon?.imgMode"
|
|
98
|
+
:width="icon?.width"
|
|
99
|
+
:height="icon?.height"
|
|
100
|
+
:top="icon?.top"
|
|
101
|
+
:stop="icon?.stop"
|
|
102
|
+
:round="icon?.round"
|
|
103
|
+
:customStyle="icon?.customStyle || { marginRight: '2px' }"
|
|
104
|
+
></hy-icon>
|
|
105
|
+
<text
|
|
106
|
+
class="hy-button__text"
|
|
107
|
+
:style="[
|
|
108
|
+
{
|
|
109
|
+
marginLeft: icon ? '2px' : 0
|
|
110
|
+
},
|
|
111
|
+
nvueTextStyle
|
|
112
|
+
]"
|
|
113
|
+
:class="[plain && `hy-button__text--plain--${type}`]"
|
|
114
|
+
>
|
|
115
|
+
{{ text }}
|
|
116
|
+
</text>
|
|
117
|
+
</template>
|
|
118
|
+
</view>
|
|
119
|
+
<!-- #endif -->
|
|
120
|
+
</template>
|
|
121
|
+
|
|
122
|
+
<script lang="ts">
|
|
123
|
+
export default {
|
|
124
|
+
name: 'hy-button',
|
|
125
|
+
options: {
|
|
126
|
+
addGlobalClass: true,
|
|
127
|
+
virtualHost: true,
|
|
128
|
+
styleIsolation: 'shared'
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
</script>
|
|
132
|
+
|
|
133
|
+
<script setup lang="ts">
|
|
134
|
+
import { computed } from 'vue'
|
|
135
|
+
import type { CSSProperties } from 'vue'
|
|
136
|
+
import { ColorConfig, bem, throttle } from '../../libs'
|
|
137
|
+
import type { IButtonEmits } from './typing'
|
|
138
|
+
import buttonProps from '../hy-button/props'
|
|
139
|
+
// 组件
|
|
140
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
141
|
+
import HyLoading from '../hy-loading/hy-loading.vue'
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* 该组件内部实现以uni-app的基础button组件为基础,进行二次封装
|
|
145
|
+
* @displayName hy-button
|
|
146
|
+
*/
|
|
147
|
+
defineOptions({})
|
|
148
|
+
|
|
149
|
+
const props = defineProps(buttonProps)
|
|
150
|
+
const emit = defineEmits<IButtonEmits>()
|
|
151
|
+
|
|
152
|
+
const textColor = (ColorConfig as any)[props.type]
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @description 生成bem风格的类名
|
|
156
|
+
*/
|
|
157
|
+
const bemClass = computed(() => {
|
|
158
|
+
// this.bem为一个computed变量,在mixin中
|
|
159
|
+
if (!props.color) {
|
|
160
|
+
return bem('button', props, ['type', 'shape', 'size'], ['disabled', 'plain', 'hairline'])
|
|
161
|
+
} else {
|
|
162
|
+
// 由于nvue的原因,在有color参数时,不需要传入type,否则会生成type相关的类型,影响最终的样式
|
|
163
|
+
return bem('button', props, ['shape', 'size'], ['disabled', 'plain', 'hairline'])
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
const loadingColor = computed(() => {
|
|
168
|
+
if (props.plain) {
|
|
169
|
+
// 如果有设置color值,则用color值,否则使用type主题颜色
|
|
170
|
+
return props.color ? props.color : ''
|
|
171
|
+
}
|
|
172
|
+
if (props.type === 'info') {
|
|
173
|
+
return '#c9c9c9'
|
|
174
|
+
}
|
|
175
|
+
return '#fff'
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
const iconColorCom = computed((): string => {
|
|
179
|
+
// 如果是镂空状态,设置了color就用color值,否则使用主题颜色,
|
|
180
|
+
if (props.icon?.color) return props.icon?.color
|
|
181
|
+
if (props.plain) {
|
|
182
|
+
return props.color ? props.color : ''
|
|
183
|
+
} else {
|
|
184
|
+
return '#ffffff'
|
|
185
|
+
}
|
|
186
|
+
})
|
|
187
|
+
const baseColor = computed((): CSSProperties => {
|
|
188
|
+
let style: CSSProperties = {}
|
|
189
|
+
if (props.color) {
|
|
190
|
+
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
|
|
191
|
+
style.color = props.plain ? props.color : 'white'
|
|
192
|
+
if (!props.plain) {
|
|
193
|
+
// 非镂空,背景色使用自定义的颜色
|
|
194
|
+
style['background'] = props.color
|
|
195
|
+
}
|
|
196
|
+
if (props.color.indexOf('gradient') !== -1) {
|
|
197
|
+
// 如果自定义的颜色为渐变色,不显示边框,以及通过backgroundImage设置渐变色
|
|
198
|
+
// weex文档说明可以写borderWidth的形式,为什么这里需要分开写?
|
|
199
|
+
// 因为weex是阿里巴巴为了部门业绩考核而做的你懂的东西,所以需要这么写才有效
|
|
200
|
+
style.borderTopWidth = 0
|
|
201
|
+
style.borderRightWidth = 0
|
|
202
|
+
style.borderBottomWidth = 0
|
|
203
|
+
style.borderLeftWidth = 0
|
|
204
|
+
if (!props.plain) {
|
|
205
|
+
style.backgroundImage = props.color
|
|
206
|
+
}
|
|
207
|
+
} else {
|
|
208
|
+
// 非渐变色,则设置边框相关的属性
|
|
209
|
+
style.borderColor = props.color
|
|
210
|
+
style.borderWidth = '1px'
|
|
211
|
+
style.borderStyle = 'solid'
|
|
212
|
+
}
|
|
213
|
+
} else {
|
|
214
|
+
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
|
|
215
|
+
// style.color = props.plain ? textColor : "";
|
|
216
|
+
}
|
|
217
|
+
return style
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
// nvue版本按钮的字体不会继承父组件的颜色,需要对每一个text组件进行单独的设置
|
|
221
|
+
const nvueTextStyle = computed((): CSSProperties => {
|
|
222
|
+
let style: CSSProperties = {}
|
|
223
|
+
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
|
|
224
|
+
if (props.type === 'info') {
|
|
225
|
+
style.color = '#323233'
|
|
226
|
+
}
|
|
227
|
+
if (props.color) {
|
|
228
|
+
style.color = props.plain ? props.color : 'white'
|
|
229
|
+
}
|
|
230
|
+
style.fontSize = textSize.value + 'px'
|
|
231
|
+
return style
|
|
232
|
+
})
|
|
233
|
+
/**
|
|
234
|
+
* 字体大小
|
|
235
|
+
* */
|
|
236
|
+
const textSize = computed((): number => {
|
|
237
|
+
let fontSize = 14
|
|
238
|
+
if (props.size === 'large') fontSize = 16
|
|
239
|
+
if (props.size === 'medium') fontSize = 14
|
|
240
|
+
if (props.size === 'small') fontSize = 12
|
|
241
|
+
if (props.size === 'mini') fontSize = 10
|
|
242
|
+
return fontSize
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
const clickHandler = (e: any) => {
|
|
246
|
+
// 非禁止并且非加载中,才能点击
|
|
247
|
+
if (!props.disabled && !props.loading) {
|
|
248
|
+
// 进行节流控制,每this.throttle毫秒内,只在开始处执行
|
|
249
|
+
throttle(() => {
|
|
250
|
+
emit('click', e)
|
|
251
|
+
}, props.throttleTime)
|
|
252
|
+
}
|
|
253
|
+
// 是否阻止事件传播
|
|
254
|
+
props.stop && e.stopPropagation()
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* 支付宝小程序授权
|
|
259
|
+
* @param e
|
|
260
|
+
*/
|
|
261
|
+
function getAuthorize(e: any) {
|
|
262
|
+
if (props.scope === 'phoneNumber') {
|
|
263
|
+
getphonenumber(e)
|
|
264
|
+
} else if (props.scope === 'userInfo') {
|
|
265
|
+
getuserinfo(e)
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* 获取用户手机号回调
|
|
270
|
+
* */
|
|
271
|
+
const getphonenumber = (e: any) => {
|
|
272
|
+
emit('getphonenumber', e)
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* 用户点击该按钮时,会返回获取到的用户信息,从返回参数的detail中获取到的值同uni.getUserInfo
|
|
276
|
+
* */
|
|
277
|
+
const getuserinfo = (e: any) => {
|
|
278
|
+
emit('getuserinfo', e)
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* 当使用开放能力时,发生错误的回调
|
|
282
|
+
* */
|
|
283
|
+
const error = (e: any) => {
|
|
284
|
+
emit('error', e)
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* 在打开授权设置页并关闭后回调
|
|
288
|
+
* */
|
|
289
|
+
const opensetting = (e: any) => {
|
|
290
|
+
emit('opensetting', e)
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* 从小程序打开 App 成功的回调
|
|
294
|
+
* */
|
|
295
|
+
const launchapp = (e: any) => {
|
|
296
|
+
emit('launchapp', e)
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* 用户同意隐私协议事件回调,open-type="agreePrivacyAuthorization"时有效
|
|
300
|
+
* */
|
|
301
|
+
const agreeprivacyauthorization = (e: any) => {
|
|
302
|
+
emit('agreeprivacyauthorization', e)
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* 获取用户头像回调
|
|
306
|
+
* */
|
|
307
|
+
const chooseavatar = (e: any) => {
|
|
308
|
+
emit('chooseavatar', e)
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* 客服消息回调
|
|
312
|
+
* */
|
|
313
|
+
const contact = (e: any) => {
|
|
314
|
+
emit('contact', e)
|
|
315
|
+
}
|
|
316
|
+
</script>
|
|
317
|
+
|
|
318
|
+
<style lang="scss" scoped>
|
|
319
|
+
@import './index.scss';
|
|
320
|
+
</style>
|