hy-app 0.4.13 → 0.5.0
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/components/hy-action-sheet/hy-action-sheet.vue +155 -238
- package/components/hy-action-sheet/props.ts +68 -15
- package/components/hy-action-sheet/typing.d.ts +115 -115
- package/components/hy-address-picker/hy-address-picker.vue +185 -289
- package/components/hy-address-picker/props.ts +97 -21
- package/components/hy-address-picker/typing.d.ts +90 -89
- package/components/hy-avatar/hy-avatar.vue +121 -204
- package/components/hy-avatar/props.ts +76 -18
- package/components/hy-avatar/typing.d.ts +63 -62
- package/components/hy-back-top/hy-back-top.vue +65 -120
- package/components/hy-back-top/props.ts +57 -16
- package/components/hy-back-top/typing.d.ts +43 -42
- package/components/hy-badge/hy-badge.vue +66 -138
- package/components/hy-badge/props.ts +73 -17
- package/components/hy-badge/typing.d.ts +59 -58
- package/components/hy-button/hy-button.vue +226 -375
- package/components/hy-button/props.ts +129 -158
- package/components/hy-calendar/header.vue +48 -64
- package/components/hy-calendar/hy-calendar.vue +274 -438
- package/components/hy-calendar/month.vue +508 -516
- package/components/hy-calendar/props.ts +157 -35
- package/components/hy-calendar/typing.d.ts +129 -128
- package/components/hy-card/hy-card.vue +118 -240
- package/components/hy-card/index.scss +1 -2
- package/components/hy-card/props.ts +122 -27
- package/components/hy-card/typing.d.ts +119 -118
- package/components/hy-cell/hy-cell.vue +176 -258
- package/components/hy-cell/props.ts +71 -17
- package/components/hy-cell/typing.d.ts +87 -86
- package/components/hy-check-button/hy-check-button.vue +69 -139
- package/components/hy-check-button/props.ts +72 -18
- package/components/hy-check-button/typing.d.ts +74 -73
- package/components/hy-checkbox/hy-checkbox.vue +170 -263
- package/components/hy-checkbox/props.ts +94 -24
- package/components/hy-checkbox/typing.d.ts +72 -72
- package/components/hy-checkbox-group/hy-checkbox-group.vue +25 -100
- package/components/hy-checkbox-group/props.ts +80 -0
- package/components/hy-checkbox-group/typing.d.ts +65 -65
- package/components/hy-checkbox-item/hy-checkbox-item.vue +140 -177
- package/components/hy-checkbox-item/props.ts +24 -0
- package/components/hy-checkbox-item/typing.d.ts +4 -3
- package/components/hy-code-input/hy-code-input.vue +179 -262
- package/components/hy-code-input/props.ts +84 -18
- package/components/hy-code-input/typing.d.ts +71 -71
- package/components/hy-config-provider/hy-config-provider.vue +28 -50
- package/components/hy-config-provider/props.ts +26 -11
- package/components/hy-config-provider/typing.d.ts +20 -20
- package/components/hy-count-down/hy-count-down.vue +103 -131
- package/components/hy-count-down/props.ts +30 -8
- package/components/hy-count-down/typing.d.ts +25 -25
- package/components/hy-count-to/hy-count-to.vue +148 -213
- package/components/hy-count-to/props.ts +60 -15
- package/components/hy-count-to/typing.d.ts +46 -46
- package/components/hy-coupon/README.md +133 -0
- package/components/hy-coupon/hy-coupon.vue +180 -0
- package/components/hy-coupon/index.scss +553 -0
- package/components/hy-coupon/props.ts +129 -0
- package/components/hy-coupon/typing.d.ts +146 -0
- package/components/hy-datetime-picker/hy-datetime-picker.vue +415 -580
- package/components/hy-datetime-picker/props.ts +142 -32
- package/components/hy-datetime-picker/typing.d.ts +132 -132
- package/components/hy-divider/hy-divider.vue +90 -169
- package/components/hy-divider/props.ts +78 -19
- package/components/hy-divider/typing.d.ts +60 -60
- package/components/hy-dropdown/hy-dropdown.vue +37 -71
- package/components/hy-dropdown/props.ts +38 -15
- package/components/hy-dropdown/typing.d.ts +44 -44
- package/components/hy-dropdown-item/hy-dropdown-item.vue +141 -173
- package/components/hy-dropdown-item/props.ts +19 -8
- package/components/hy-empty/hy-empty.vue +75 -129
- package/components/hy-empty/props.ts +57 -15
- package/components/hy-empty/typing.d.ts +84 -84
- package/components/hy-flex/hy-flex.vue +33 -88
- package/components/hy-flex/props.ts +58 -0
- package/components/hy-flex/typing.d.ts +14 -16
- package/components/hy-float-button/hy-float-button.vue +289 -406
- package/components/hy-float-button/props.ts +109 -25
- package/components/hy-folding-panel/hy-folding-panel.vue +86 -374
- package/components/hy-folding-panel/props.ts +40 -15
- package/components/hy-folding-panel/typing.d.ts +52 -63
- package/components/hy-folding-panel-item/hy-folding-panel-item.vue +186 -228
- package/components/hy-folding-panel-item/index.scss +87 -0
- package/components/hy-folding-panel-item/props.ts +81 -0
- package/components/hy-folding-panel-item/typing.d.ts +23 -0
- package/components/hy-form/hy-form.vue +172 -212
- package/components/hy-form/props.ts +37 -0
- package/components/hy-form/typing.d.ts +68 -61
- package/components/hy-form-group/typing.d.ts +74 -74
- package/components/hy-form-item/hy-form-item.vue +100 -129
- package/components/hy-form-item/props.ts +25 -0
- package/components/hy-form-item/typing.d.ts +40 -37
- package/components/hy-grid/hy-grid.vue +76 -132
- package/components/hy-grid/props.ts +58 -16
- package/components/hy-grid/typing.d.ts +66 -66
- package/components/hy-icon/hy-icon.vue +84 -161
- package/components/hy-icon/props.ts +76 -22
- package/components/hy-icon/typing.d.ts +83 -82
- package/components/hy-image/hy-image.vue +142 -272
- package/components/hy-image/props.ts +105 -23
- package/components/hy-image/typing.d.ts +84 -87
- package/components/hy-input/hy-input.vue +230 -421
- package/components/hy-input/props.ts +183 -35
- package/components/hy-input/typing.d.ts +169 -169
- package/components/hy-line/hy-line.vue +34 -72
- package/components/hy-line/props.ts +41 -10
- package/components/hy-line/typing.d.ts +29 -29
- package/components/hy-line-progress/hy-line-progress.vue +66 -101
- package/components/hy-line-progress/props.ts +31 -10
- package/components/hy-line-progress/typing.d.ts +29 -29
- package/components/hy-list/hy-list.vue +151 -220
- package/components/hy-list/props.ts +67 -16
- package/components/hy-list/typing.d.ts +52 -52
- package/components/hy-loading/hy-loading.vue +63 -119
- package/components/hy-loading/props.ts +63 -15
- package/components/hy-loading/typing.d.ts +49 -49
- package/components/hy-menu/hy-menu.vue +124 -166
- package/components/hy-menu/props.ts +42 -10
- package/components/hy-menu/typing.d.ts +60 -60
- package/components/hy-modal/hy-modal.vue +127 -218
- package/components/hy-modal/props.ts +89 -24
- package/components/hy-navbar/hy-navbar.vue +104 -177
- package/components/hy-navbar/props.ts +76 -22
- package/components/hy-navbar/typing.d.ts +81 -81
- package/components/hy-notice-bar/hy-notice-bar.vue +67 -144
- package/components/hy-notice-bar/props.ts +80 -19
- package/components/hy-notice-bar/typing.d.ts +62 -62
- package/components/hy-notify/hy-notify.vue +128 -177
- package/components/hy-notify/props.ts +49 -12
- package/components/hy-notify/typing.d.ts +45 -41
- package/components/hy-number-step/hy-number-step.vue +281 -394
- package/components/hy-number-step/props.ts +110 -27
- package/components/hy-number-step/typing.d.ts +120 -120
- package/components/hy-overlay/hy-overlay.vue +39 -66
- package/components/hy-overlay/props.ts +31 -8
- package/components/hy-pagination/hy-pagination.vue +100 -155
- package/components/hy-pagination/props.ts +53 -13
- package/components/hy-picker/hy-picker.vue +309 -430
- package/components/hy-picker/index.scss +8 -12
- package/components/hy-picker/props.ts +110 -26
- package/components/hy-popover/hy-popover.vue +190 -252
- package/components/hy-popover/props.ts +48 -10
- package/components/hy-popup/hy-popup.vue +162 -248
- package/components/hy-popup/props.ts +82 -18
- package/components/hy-price/hy-price.vue +45 -104
- package/components/hy-price/props.ts +52 -12
- package/components/hy-price/typing.d.ts +41 -36
- package/components/hy-qrcode/hy-qrcode.vue +115 -185
- package/components/hy-qrcode/props.ts +68 -18
- package/components/hy-qrcode/typing.d.ts +67 -66
- package/components/hy-radio/hy-radio.vue +161 -259
- package/components/hy-radio/props.ts +95 -25
- package/components/hy-radio/typing.d.ts +85 -84
- package/components/hy-rate/hy-rate.vue +185 -270
- package/components/hy-rate/props.ts +76 -18
- package/components/hy-rate/typing.d.ts +61 -60
- package/components/hy-read-more/hy-read-more.vue +93 -136
- package/components/hy-read-more/props.ts +43 -13
- package/components/hy-scroll-list/hy-scroll-list.vue +81 -102
- package/components/hy-scroll-list/props.ts +22 -11
- package/components/hy-search/hy-search.vue +155 -284
- package/components/hy-search/props.ts +130 -25
- package/components/hy-signature/hy-signature.vue +491 -635
- package/components/hy-signature/props.ts +115 -26
- package/components/hy-signature/typing.d.ts +138 -138
- package/components/hy-slider/hy-slider.vue +388 -477
- package/components/hy-slider/props.ts +75 -19
- package/components/hy-steps/hy-steps.vue +212 -279
- package/components/hy-steps/props.ts +47 -13
- package/components/hy-submit-bar/hy-submit-bar.vue +137 -222
- package/components/hy-submit-bar/props.ts +89 -20
- package/components/hy-submit-bar/typing.d.ts +86 -85
- package/components/hy-subsection/hy-subsection.vue +132 -185
- package/components/hy-subsection/props.ts +50 -17
- package/components/hy-subsection/typing.d.ts +52 -52
- package/components/hy-swipe-action/hy-swipe-action.vue +228 -283
- package/components/hy-swipe-action/props.ts +43 -18
- package/components/hy-swipe-action/typing.d.ts +46 -46
- package/components/hy-swiper/hy-swiper.vue +159 -286
- package/components/hy-swiper/props.ts +126 -28
- package/components/hy-swiper/typing.d.ts +115 -115
- package/components/hy-switch/hy-switch.vue +112 -176
- package/components/hy-switch/props.ts +60 -15
- package/components/hy-switch/typing.d.ts +63 -63
- package/components/hy-tabBar/hy-tabBar.vue +64 -60
- package/components/hy-tabs/hy-tabs.vue +277 -380
- package/components/hy-tabs/props.ts +75 -18
- package/components/hy-tag/hy-tag.vue +111 -204
- package/components/hy-tag/props.ts +81 -19
- package/components/hy-text/hy-text.vue +200 -322
- package/components/hy-text/props.ts +107 -28
- package/components/hy-textarea/hy-textarea.vue +147 -256
- package/components/hy-textarea/props.ts +112 -25
- package/components/hy-textarea/typing.d.ts +42 -42
- package/components/hy-toast/hy-toast.vue +135 -143
- package/components/hy-tooltip/hy-tooltip.vue +220 -306
- package/components/hy-tooltip/props.ts +79 -15
- package/components/hy-transition/hy-transition.vue +111 -138
- package/components/hy-transition/props.ts +30 -8
- package/components/hy-upload/hy-upload.vue +320 -469
- package/components/hy-upload/props.ts +130 -27
- package/components/hy-warn/hy-warn.vue +80 -129
- package/components/hy-warn/props.ts +47 -12
- package/components/hy-waterfall/hy-waterfall.vue +139 -163
- package/components/hy-waterfall/props.ts +19 -7
- package/components/hy-watermark/hy-watermark.vue +762 -870
- package/components/hy-watermark/props.ts +103 -22
- package/global.d.ts +2 -0
- package/libs/css/theme.scss +3 -3
- package/package.json +2 -2
- package/web-types.json +1 -1
- package/components/hy-folding-panel/index.scss +0 -9
|
@@ -1,424 +1,275 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
<slot v-if="$slots.default"></slot>
|
|
59
|
-
<text
|
|
60
|
-
v-else
|
|
61
|
-
class="hy-button__text"
|
|
62
|
-
:style="[{ fontSize: textSize + 'px' }]"
|
|
63
|
-
>{{ text }}</text
|
|
64
|
-
>
|
|
65
|
-
</template>
|
|
66
|
-
</button>
|
|
67
|
-
<!-- #endif -->
|
|
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
|
+
:app-parameter="appParameter"
|
|
9
|
+
:hover-stop-propagation="hoverStopPropagation"
|
|
10
|
+
:send-message-title="sendMessageTitle"
|
|
11
|
+
:send-message-path="sendMessagePath"
|
|
12
|
+
:lang="lang"
|
|
13
|
+
:data-name="dataName"
|
|
14
|
+
:session-from="sessionFrom"
|
|
15
|
+
:send-message-img="sendMessageImg"
|
|
16
|
+
:show-message-card="showMessageCard"
|
|
17
|
+
@getphonenumber="getphonenumber"
|
|
18
|
+
@getuserinfo="getuserinfo"
|
|
19
|
+
@error="error"
|
|
20
|
+
@opensetting="opensetting"
|
|
21
|
+
@launchapp="launchapp"
|
|
22
|
+
@agreeprivacyauthorization="agreeprivacyauthorization"
|
|
23
|
+
:hover-class="!disabled && !loading ? 'hy-button--active' : ''"
|
|
24
|
+
:style="[baseColor, customStyle]"
|
|
25
|
+
@click="clickHandler"
|
|
26
|
+
:class="['hy-button', 'hy-reset-button', bemClass, customClass]"
|
|
27
|
+
>
|
|
28
|
+
<template v-if="loading">
|
|
29
|
+
<HyLoading :mode="loadingMode" :size="loadingSize" :color="loadingColor"></HyLoading>
|
|
30
|
+
<text class="hy-button__loading-text" :style="[{ fontSize: textSize + 'px' }]">
|
|
31
|
+
{{ loadingText || text }}
|
|
32
|
+
</text>
|
|
33
|
+
</template>
|
|
34
|
+
<template v-else>
|
|
35
|
+
<HyIcon
|
|
36
|
+
v-if="icon?.name"
|
|
37
|
+
:name="icon?.name"
|
|
38
|
+
:color="iconColorCom"
|
|
39
|
+
:size="icon?.size || textSize * 1.35"
|
|
40
|
+
:bold="icon?.bold"
|
|
41
|
+
:customPrefix="icon?.customPrefix"
|
|
42
|
+
:imgMode="icon?.imgMode"
|
|
43
|
+
:width="icon?.width"
|
|
44
|
+
:height="icon?.height"
|
|
45
|
+
:top="icon?.top"
|
|
46
|
+
:stop="icon?.stop"
|
|
47
|
+
:round="icon?.round"
|
|
48
|
+
:customStyle="icon?.customStyle || { marginRight: '2px' }"
|
|
49
|
+
></HyIcon>
|
|
50
|
+
<!-- @slot 插入默认的值 -->
|
|
51
|
+
<slot v-if="$slots.default"></slot>
|
|
52
|
+
<text v-else class="hy-button__text" :style="[{ fontSize: textSize + 'px' }]">{{
|
|
53
|
+
text
|
|
54
|
+
}}</text>
|
|
55
|
+
</template>
|
|
56
|
+
</button>
|
|
57
|
+
<!-- #endif -->
|
|
68
58
|
|
|
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
|
-
</text>
|
|
127
|
-
</template>
|
|
128
|
-
</view>
|
|
129
|
-
<!-- #endif -->
|
|
59
|
+
<!-- #ifdef APP-NVUE -->
|
|
60
|
+
<view
|
|
61
|
+
:hover-start-time="Number(hoverStartTime)"
|
|
62
|
+
:hover-stay-time="Number(hoverStayTime)"
|
|
63
|
+
class="hy-button"
|
|
64
|
+
:hover-class="
|
|
65
|
+
!disabled && !loading && !color && (plain || type === 'info')
|
|
66
|
+
? 'hy-button--active--plain'
|
|
67
|
+
: !disabled && !loading && !plain
|
|
68
|
+
? 'hy-button--active'
|
|
69
|
+
: ''
|
|
70
|
+
"
|
|
71
|
+
@click="clickHandler"
|
|
72
|
+
:class="bemClass"
|
|
73
|
+
:style="[baseColor, customStyle]"
|
|
74
|
+
>
|
|
75
|
+
<template v-if="loading">
|
|
76
|
+
<HyLoading :mode="loadingMode" :size="loadingSize" :color="loadingColor"></HyLoading>
|
|
77
|
+
<text
|
|
78
|
+
class="hy-button__loading-text"
|
|
79
|
+
:style="[nvueTextStyle]"
|
|
80
|
+
:class="[plain && `hy-button__text--plain--${type}`]"
|
|
81
|
+
>
|
|
82
|
+
{{ loadingText || text }}
|
|
83
|
+
</text>
|
|
84
|
+
</template>
|
|
85
|
+
<template v-else>
|
|
86
|
+
<HyIcon
|
|
87
|
+
v-if="icon?.name"
|
|
88
|
+
:name="icon?.name"
|
|
89
|
+
:color="iconColorCom"
|
|
90
|
+
:size="icon?.size || textSize * 1.35"
|
|
91
|
+
:bold="icon?.bold"
|
|
92
|
+
:customPrefix="icon?.customPrefix"
|
|
93
|
+
:imgMode="icon?.imgMode"
|
|
94
|
+
:width="icon?.width"
|
|
95
|
+
:height="icon?.height"
|
|
96
|
+
:top="icon?.top"
|
|
97
|
+
:stop="icon?.stop"
|
|
98
|
+
:round="icon?.round"
|
|
99
|
+
:customStyle="icon?.customStyle || { marginRight: '2px' }"
|
|
100
|
+
></HyIcon>
|
|
101
|
+
<text
|
|
102
|
+
class="hy-button__text"
|
|
103
|
+
:style="[
|
|
104
|
+
{
|
|
105
|
+
marginLeft: icon ? '2px' : 0
|
|
106
|
+
},
|
|
107
|
+
nvueTextStyle
|
|
108
|
+
]"
|
|
109
|
+
:class="[plain && `hy-button__text--plain--${type}`]"
|
|
110
|
+
>
|
|
111
|
+
{{ text }}
|
|
112
|
+
</text>
|
|
113
|
+
</template>
|
|
114
|
+
</view>
|
|
115
|
+
<!-- #endif -->
|
|
130
116
|
</template>
|
|
131
117
|
|
|
132
118
|
<script lang="ts">
|
|
133
119
|
export default {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
120
|
+
name: 'hy-button',
|
|
121
|
+
options: {
|
|
122
|
+
addGlobalClass: true,
|
|
123
|
+
virtualHost: true,
|
|
124
|
+
styleIsolation: 'shared'
|
|
125
|
+
}
|
|
126
|
+
}
|
|
141
127
|
</script>
|
|
142
128
|
|
|
143
129
|
<script setup lang="ts">
|
|
144
|
-
import { computed } from
|
|
145
|
-
import type { CSSProperties
|
|
146
|
-
import { ColorConfig, bem, throttle } from
|
|
147
|
-
import type { IButtonEmits } from
|
|
148
|
-
import
|
|
130
|
+
import { computed } from 'vue'
|
|
131
|
+
import type { CSSProperties } from 'vue'
|
|
132
|
+
import { ColorConfig, bem, throttle } from '../../libs'
|
|
133
|
+
import type { IButtonEmits } from './typing'
|
|
134
|
+
import buttonProps from '../hy-button/props'
|
|
149
135
|
// 组件
|
|
150
|
-
import HyIcon from
|
|
151
|
-
import HyLoading from
|
|
136
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
137
|
+
import HyLoading from '../hy-loading/hy-loading.vue'
|
|
152
138
|
|
|
153
139
|
/**
|
|
154
140
|
* 该组件内部实现以uni-app的基础button组件为基础,进行二次封装
|
|
155
141
|
* @displayName hy-button
|
|
156
142
|
*/
|
|
157
|
-
defineOptions({})
|
|
143
|
+
defineOptions({})
|
|
158
144
|
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
/** 是否显示按钮的细边框 */
|
|
162
|
-
hairline: {
|
|
163
|
-
type: Boolean,
|
|
164
|
-
default: false,
|
|
165
|
-
},
|
|
166
|
-
/**
|
|
167
|
-
* 按钮的预置样式
|
|
168
|
-
* @values info,primary,error,warning,success
|
|
169
|
-
* */
|
|
170
|
-
type: {
|
|
171
|
-
type: String,
|
|
172
|
-
default: "primary",
|
|
173
|
-
},
|
|
174
|
-
/**
|
|
175
|
-
* 按钮尺寸
|
|
176
|
-
* @values large,medium,small,mini
|
|
177
|
-
* */
|
|
178
|
-
size: {
|
|
179
|
-
type: String,
|
|
180
|
-
default: "medium",
|
|
181
|
-
},
|
|
182
|
-
/**
|
|
183
|
-
* 按钮形状
|
|
184
|
-
* @values circle,square
|
|
185
|
-
* */
|
|
186
|
-
shape: {
|
|
187
|
-
type: String,
|
|
188
|
-
default: "square",
|
|
189
|
-
},
|
|
190
|
-
/** 按钮是否镂空,背景色透明 */
|
|
191
|
-
plain: {
|
|
192
|
-
type: Boolean,
|
|
193
|
-
default: false,
|
|
194
|
-
},
|
|
195
|
-
/** 是否禁用 */
|
|
196
|
-
disabled: {
|
|
197
|
-
type: Boolean,
|
|
198
|
-
default: false,
|
|
199
|
-
},
|
|
200
|
-
/** 按钮名称前是否带 loading 图标 */
|
|
201
|
-
loading: {
|
|
202
|
-
type: Boolean,
|
|
203
|
-
default: false,
|
|
204
|
-
},
|
|
205
|
-
/** 加载中提示文字 */
|
|
206
|
-
loadingText: String,
|
|
207
|
-
/**
|
|
208
|
-
* 加载状态图标类型
|
|
209
|
-
* @values spinner,circle,semicircle
|
|
210
|
-
* */
|
|
211
|
-
loadingMode: {
|
|
212
|
-
type: String,
|
|
213
|
-
default: "spinner",
|
|
214
|
-
},
|
|
215
|
-
/** 加载图标大小 */
|
|
216
|
-
loadingSize: {
|
|
217
|
-
type: [Number, String],
|
|
218
|
-
default: 13,
|
|
219
|
-
},
|
|
220
|
-
/** 开放能力,具体请看uniapp稳定关于button组件部分说明 */
|
|
221
|
-
openType: String,
|
|
222
|
-
/** 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件 */
|
|
223
|
-
formType: String,
|
|
224
|
-
/** 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 (注:只微信小程序、QQ小程序有效) */
|
|
225
|
-
appParameter: String,
|
|
226
|
-
/** 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效 */
|
|
227
|
-
hoverStopPropagation: {
|
|
228
|
-
type: Boolean,
|
|
229
|
-
default: true,
|
|
230
|
-
},
|
|
231
|
-
/**
|
|
232
|
-
* 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文(默认 en )
|
|
233
|
-
* @values zh_CN,zh_TW,en
|
|
234
|
-
* */
|
|
235
|
-
lang: {
|
|
236
|
-
type: String,
|
|
237
|
-
default: "en",
|
|
238
|
-
},
|
|
239
|
-
/** 会话来源,openType="contact"时有效 */
|
|
240
|
-
sessionFrom: String,
|
|
241
|
-
/** 会话内消息卡片标题,openType="contact"时有效 */
|
|
242
|
-
sendMessageTitle: String,
|
|
243
|
-
/** 会话内消息卡片点击跳转小程序路径,openType="contact"时有效 */
|
|
244
|
-
sendMessagePath: String,
|
|
245
|
-
/** 会话内消息卡片图片,openType="contact"时有效 */
|
|
246
|
-
sendMessageImg: String,
|
|
247
|
-
/** 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效 */
|
|
248
|
-
showMessageCard: {
|
|
249
|
-
type: Boolean,
|
|
250
|
-
default: false,
|
|
251
|
-
},
|
|
252
|
-
/** 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取 */
|
|
253
|
-
dataName: String,
|
|
254
|
-
/** 节流时间,一定时间内只能触发一次 */
|
|
255
|
-
throttleTime: {
|
|
256
|
-
type: Number,
|
|
257
|
-
default: 0,
|
|
258
|
-
},
|
|
259
|
-
/** 按住后多久出现点击态,单位毫秒 */
|
|
260
|
-
hoverStartTime: {
|
|
261
|
-
type: Number,
|
|
262
|
-
default: 0,
|
|
263
|
-
},
|
|
264
|
-
/** 手指松开后点击态保留时间,单位毫秒 */
|
|
265
|
-
hoverStayTime: {
|
|
266
|
-
type: Number,
|
|
267
|
-
default: 200,
|
|
268
|
-
},
|
|
269
|
-
/** 按钮文字,之所以通过props传入,是因为slot传入的话(注:nvue中无法控制文字的样式) */
|
|
270
|
-
text: String,
|
|
271
|
-
/** 按钮图标api集合 */
|
|
272
|
-
icon: Object as PropType<HyIconProps>,
|
|
273
|
-
/** 按钮颜色,支持传入linear-gradient渐变色 */
|
|
274
|
-
color: String,
|
|
275
|
-
/** 阻止事件冒泡 */
|
|
276
|
-
stop: {
|
|
277
|
-
type: Boolean,
|
|
278
|
-
default: true,
|
|
279
|
-
},
|
|
280
|
-
/** 定义需要用到的外部样式 */
|
|
281
|
-
customStyle: Object as unknown as PropType<CSSProperties>,
|
|
282
|
-
/** 自定义外部类名 */
|
|
283
|
-
customClass: String,
|
|
284
|
-
});
|
|
285
|
-
const emit = defineEmits<IButtonEmits>();
|
|
145
|
+
const props = defineProps(buttonProps)
|
|
146
|
+
const emit = defineEmits<IButtonEmits>()
|
|
286
147
|
|
|
287
|
-
const textColor = (ColorConfig as any)[props.type]
|
|
148
|
+
const textColor = (ColorConfig as any)[props.type]
|
|
288
149
|
|
|
289
150
|
/**
|
|
290
151
|
* @description 生成bem风格的类名
|
|
291
152
|
*/
|
|
292
153
|
const bemClass = computed(() => {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
} else {
|
|
302
|
-
// 由于nvue的原因,在有color参数时,不需要传入type,否则会生成type相关的类型,影响最终的样式
|
|
303
|
-
return bem(
|
|
304
|
-
"button",
|
|
305
|
-
props,
|
|
306
|
-
["shape", "size"],
|
|
307
|
-
["disabled", "plain", "hairline"],
|
|
308
|
-
);
|
|
309
|
-
}
|
|
310
|
-
});
|
|
154
|
+
// this.bem为一个computed变量,在mixin中
|
|
155
|
+
if (!props.color) {
|
|
156
|
+
return bem('button', props, ['type', 'shape', 'size'], ['disabled', 'plain', 'hairline'])
|
|
157
|
+
} else {
|
|
158
|
+
// 由于nvue的原因,在有color参数时,不需要传入type,否则会生成type相关的类型,影响最终的样式
|
|
159
|
+
return bem('button', props, ['shape', 'size'], ['disabled', 'plain', 'hairline'])
|
|
160
|
+
}
|
|
161
|
+
})
|
|
311
162
|
|
|
312
163
|
const loadingColor = computed(() => {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
})
|
|
164
|
+
if (props.plain) {
|
|
165
|
+
// 如果有设置color值,则用color值,否则使用type主题颜色
|
|
166
|
+
return props.color ? props.color : ''
|
|
167
|
+
}
|
|
168
|
+
if (props.type === 'info') {
|
|
169
|
+
return '#c9c9c9'
|
|
170
|
+
}
|
|
171
|
+
return '#fff'
|
|
172
|
+
})
|
|
322
173
|
|
|
323
174
|
const iconColorCom = computed((): string => {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
const baseColor = computed((): CSSProperties => {
|
|
333
|
-
let style: CSSProperties = {};
|
|
334
|
-
if (props.color) {
|
|
335
|
-
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
|
|
336
|
-
style.color = props.plain ? props.color : "white";
|
|
337
|
-
if (!props.plain) {
|
|
338
|
-
// 非镂空,背景色使用自定义的颜色
|
|
339
|
-
style["background"] = props.color;
|
|
175
|
+
// 如果是镂空状态,设置了color就用color值,否则使用主题颜色,
|
|
176
|
+
if (props.icon?.color) return props.icon?.color
|
|
177
|
+
if (props.plain) {
|
|
178
|
+
return props.color ? props.color : ''
|
|
179
|
+
} else {
|
|
180
|
+
return '#ffffff'
|
|
340
181
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
182
|
+
})
|
|
183
|
+
const baseColor = computed((): CSSProperties => {
|
|
184
|
+
let style: CSSProperties = {}
|
|
185
|
+
if (props.color) {
|
|
186
|
+
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
|
|
187
|
+
style.color = props.plain ? props.color : 'white'
|
|
188
|
+
if (!props.plain) {
|
|
189
|
+
// 非镂空,背景色使用自定义的颜色
|
|
190
|
+
style['background'] = props.color
|
|
191
|
+
}
|
|
192
|
+
if (props.color.indexOf('gradient') !== -1) {
|
|
193
|
+
// 如果自定义的颜色为渐变色,不显示边框,以及通过backgroundImage设置渐变色
|
|
194
|
+
// weex文档说明可以写borderWidth的形式,为什么这里需要分开写?
|
|
195
|
+
// 因为weex是阿里巴巴为了部门业绩考核而做的你懂的东西,所以需要这么写才有效
|
|
196
|
+
style.borderTopWidth = 0
|
|
197
|
+
style.borderRightWidth = 0
|
|
198
|
+
style.borderBottomWidth = 0
|
|
199
|
+
style.borderLeftWidth = 0
|
|
200
|
+
if (!props.plain) {
|
|
201
|
+
style.backgroundImage = props.color
|
|
202
|
+
}
|
|
203
|
+
} else {
|
|
204
|
+
// 非渐变色,则设置边框相关的属性
|
|
205
|
+
style.borderColor = props.color
|
|
206
|
+
style.borderWidth = '1px'
|
|
207
|
+
style.borderStyle = 'solid'
|
|
208
|
+
}
|
|
352
209
|
} else {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
style.borderWidth = "1px";
|
|
356
|
-
style.borderStyle = "solid";
|
|
210
|
+
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
|
|
211
|
+
// style.color = props.plain ? textColor : "";
|
|
357
212
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
// style.color = props.plain ? textColor : "";
|
|
361
|
-
}
|
|
362
|
-
return style;
|
|
363
|
-
});
|
|
213
|
+
return style
|
|
214
|
+
})
|
|
364
215
|
|
|
365
216
|
// nvue版本按钮的字体不会继承父组件的颜色,需要对每一个text组件进行单独的设置
|
|
366
217
|
const nvueTextStyle = computed((): CSSProperties => {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
})
|
|
218
|
+
let style: CSSProperties = {}
|
|
219
|
+
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
|
|
220
|
+
if (props.type === 'info') {
|
|
221
|
+
style.color = '#323233'
|
|
222
|
+
}
|
|
223
|
+
if (props.color) {
|
|
224
|
+
style.color = props.plain ? props.color : 'white'
|
|
225
|
+
}
|
|
226
|
+
style.fontSize = textSize.value + 'px'
|
|
227
|
+
return style
|
|
228
|
+
})
|
|
378
229
|
/**
|
|
379
230
|
* @description 字体大小
|
|
380
231
|
* */
|
|
381
232
|
const textSize = computed((): number => {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
})
|
|
233
|
+
let fontSize = 14
|
|
234
|
+
if (props.size === 'large') fontSize = 16
|
|
235
|
+
if (props.size === 'medium') fontSize = 14
|
|
236
|
+
if (props.size === 'small') fontSize = 12
|
|
237
|
+
if (props.size === 'mini') fontSize = 10
|
|
238
|
+
return fontSize
|
|
239
|
+
})
|
|
389
240
|
|
|
390
241
|
const clickHandler = (e: any) => {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
}
|
|
242
|
+
// 非禁止并且非加载中,才能点击
|
|
243
|
+
if (!props.disabled && !props.loading) {
|
|
244
|
+
// 进行节流控制,每this.throttle毫秒内,只在开始处执行
|
|
245
|
+
throttle(() => {
|
|
246
|
+
emit('click', e)
|
|
247
|
+
}, props.throttleTime)
|
|
248
|
+
}
|
|
249
|
+
// 是否阻止事件传播
|
|
250
|
+
props.stop && e.stopPropagation()
|
|
251
|
+
}
|
|
401
252
|
|
|
402
253
|
const getphonenumber = (e: any) => {
|
|
403
|
-
|
|
404
|
-
}
|
|
254
|
+
emit('getphonenumber', e)
|
|
255
|
+
}
|
|
405
256
|
const getuserinfo = (e: any) => {
|
|
406
|
-
|
|
407
|
-
}
|
|
257
|
+
emit('getuserinfo', e)
|
|
258
|
+
}
|
|
408
259
|
const error = (e: any) => {
|
|
409
|
-
|
|
410
|
-
}
|
|
260
|
+
emit('error', e)
|
|
261
|
+
}
|
|
411
262
|
const opensetting = (e: any) => {
|
|
412
|
-
|
|
413
|
-
}
|
|
263
|
+
emit('opensetting', e)
|
|
264
|
+
}
|
|
414
265
|
const launchapp = (e: any) => {
|
|
415
|
-
|
|
416
|
-
}
|
|
266
|
+
emit('launchapp', e)
|
|
267
|
+
}
|
|
417
268
|
const agreeprivacyauthorization = (e: any) => {
|
|
418
|
-
|
|
419
|
-
}
|
|
269
|
+
emit('agreeprivacyauthorization', e)
|
|
270
|
+
}
|
|
420
271
|
</script>
|
|
421
272
|
|
|
422
273
|
<style lang="scss" scoped>
|
|
423
|
-
@import
|
|
274
|
+
@import './index.scss';
|
|
424
275
|
</style>
|