hy-app 0.1.1
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/README.md +42 -0
- package/api/http.ts +138 -0
- package/api/index.ts +1 -0
- package/common/index.ts +1 -0
- package/common/versionControl.ts +102 -0
- package/components/dialog/TheDialog.vue +128 -0
- package/components/dialog/index.ts +38 -0
- package/components/hy-address-picker/hy-address-picker.vue +262 -0
- package/components/hy-address-picker/props.ts +27 -0
- package/components/hy-address-picker/typing.d.ts +98 -0
- package/components/hy-avatar/hy-avatar.vue +217 -0
- package/components/hy-avatar/props.ts +20 -0
- package/components/hy-avatar/typing.d.ts +64 -0
- package/components/hy-back-top/hy-back-top.vue +71 -0
- package/components/hy-back-top/props.ts +23 -0
- package/components/hy-back-top/typing.d.ts +49 -0
- package/components/hy-badge/hy-badge.vue +155 -0
- package/components/hy-badge/props.ts +19 -0
- package/components/hy-badge/typing.d.ts +60 -0
- package/components/hy-button/hy-button.vue +394 -0
- package/components/hy-button/props.ts +36 -0
- package/components/hy-button/typing.d.ts +125 -0
- package/components/hy-card/hy-card.vue +198 -0
- package/components/hy-card/props.ts +29 -0
- package/components/hy-card/typing.d.ts +112 -0
- package/components/hy-cell/hy-cell.vue +268 -0
- package/components/hy-cell/props.ts +20 -0
- package/components/hy-cell/typing.d.ts +98 -0
- package/components/hy-check-button/hy-check-button.vue +71 -0
- package/components/hy-check-button/props.ts +20 -0
- package/components/hy-check-button/typing.d.ts +79 -0
- package/components/hy-checkbox/hy-checkbox.vue +299 -0
- package/components/hy-checkbox/props.ts +28 -0
- package/components/hy-checkbox/typing.d.ts +77 -0
- package/components/hy-datetime-picker/hy-datetime-picker.vue +584 -0
- package/components/hy-datetime-picker/props.ts +36 -0
- package/components/hy-datetime-picker/typing.d.ts +135 -0
- package/components/hy-divider/hy-divider.vue +164 -0
- package/components/hy-divider/props.ts +21 -0
- package/components/hy-divider/typing.d.ts +64 -0
- package/components/hy-empty/hy-empty.vue +122 -0
- package/components/hy-empty/props.ts +21 -0
- package/components/hy-empty/typing.d.ts +68 -0
- package/components/hy-folding-panel/hy-folding-panel.vue +94 -0
- package/components/hy-folding-panel/props.ts +17 -0
- package/components/hy-folding-panel/typing.d.ts +59 -0
- package/components/hy-form/hy-form.vue +372 -0
- package/components/hy-form/props.ts +15 -0
- package/components/hy-form/typing.d.ts +51 -0
- package/components/hy-grid/hy-grid.vue +126 -0
- package/components/hy-grid/props.ts +16 -0
- package/components/hy-grid/typing.d.ts +62 -0
- package/components/hy-icon/hy-icon.vue +207 -0
- package/components/hy-icon/props.ts +24 -0
- package/components/hy-icon/typing.d.ts +80 -0
- package/components/hy-input/hy-input.vue +402 -0
- package/components/hy-input/props.ts +41 -0
- package/components/hy-input/typing.d.ts +148 -0
- package/components/hy-line/hy-line.vue +44 -0
- package/components/hy-line/props.ts +12 -0
- package/components/hy-line/typing.d.ts +32 -0
- package/components/hy-line-progress/hy-line-progress.vue +118 -0
- package/components/hy-line-progress/props.ts +12 -0
- package/components/hy-line-progress/typing.d.ts +28 -0
- package/components/hy-list/hy-list.vue +250 -0
- package/components/hy-list/props.ts +18 -0
- package/components/hy-list/typing.d.ts +50 -0
- package/components/hy-login/ThePhoneLogin.vue +106 -0
- package/components/hy-login/TheUserLogin.vue +391 -0
- package/components/hy-login/hy-login.vue +283 -0
- package/components/hy-login/props.ts +32 -0
- package/components/hy-login/typing.d.ts +60 -0
- package/components/hy-modal/hy-modal.vue +240 -0
- package/components/hy-modal/props.ts +24 -0
- package/components/hy-modal/typing.d.ts +70 -0
- package/components/hy-navbar/hy-navbar.vue +194 -0
- package/components/hy-navbar/props.ts +24 -0
- package/components/hy-navbar/typing.d.ts +81 -0
- package/components/hy-notice-bar/hy-column-notice.vue +130 -0
- package/components/hy-notice-bar/hy-notice-bar.vue +82 -0
- package/components/hy-notice-bar/hy-row-notice.vue +182 -0
- package/components/hy-notice-bar/props.ts +19 -0
- package/components/hy-notice-bar/typing.d.ts +56 -0
- package/components/hy-number-step/hy-number-step.vue +428 -0
- package/components/hy-number-step/props.ts +29 -0
- package/components/hy-number-step/typing.d.ts +104 -0
- package/components/hy-overlay/hy-overlay.vue +54 -0
- package/components/hy-overlay/props.ts +10 -0
- package/components/hy-overlay/typing.d.ts +24 -0
- package/components/hy-picker/hy-picker.vue +499 -0
- package/components/hy-picker/props.ts +30 -0
- package/components/hy-picker/typing.d.ts +115 -0
- package/components/hy-popup/hy-popup.vue +269 -0
- package/components/hy-popup/props.ts +21 -0
- package/components/hy-popup/typing.d.ts +68 -0
- package/components/hy-price/hy-price.vue +86 -0
- package/components/hy-price/props.ts +13 -0
- package/components/hy-price/typing.d.ts +36 -0
- package/components/hy-qrcode/hy-qrcode.vue +153 -0
- package/components/hy-qrcode/props.ts +20 -0
- package/components/hy-qrcode/qrcode.js +1364 -0
- package/components/hy-qrcode/typing.d.ts +64 -0
- package/components/hy-radio/hy-radio.vue +319 -0
- package/components/hy-radio/props.ts +28 -0
- package/components/hy-radio/typing.d.ts +85 -0
- package/components/hy-rate/hy-rate.vue +261 -0
- package/components/hy-rate/props.ts +18 -0
- package/components/hy-rate/typing.d.ts +60 -0
- package/components/hy-read-more/hy-read-more.vue +134 -0
- package/components/hy-read-more/props.ts +20 -0
- package/components/hy-read-more/typing.d.ts +44 -0
- package/components/hy-safe-bottom/hy-safe-bottom.vue +64 -0
- package/components/hy-scroll-list/hy-scroll-list.vue +146 -0
- package/components/hy-scroll-list/props.ts +12 -0
- package/components/hy-scroll-list/typing.d.ts +28 -0
- package/components/hy-search/hy-search.vue +294 -0
- package/components/hy-search/props.ts +29 -0
- package/components/hy-search/typing.d.ts +109 -0
- package/components/hy-slider/hy-slider.vue +511 -0
- package/components/hy-slider/props.ts +21 -0
- package/components/hy-slider/typing.d.ts +68 -0
- package/components/hy-steps/hy-steps.vue +352 -0
- package/components/hy-steps/props.ts +15 -0
- package/components/hy-steps/typing.d.ts +58 -0
- package/components/hy-subsection/hy-subsection.vue +272 -0
- package/components/hy-subsection/props.ts +16 -0
- package/components/hy-subsection/typing.d.ts +44 -0
- package/components/hy-swiper/hy-swiper-indicator.vue +105 -0
- package/components/hy-swiper/hy-swiper.vue +242 -0
- package/components/hy-swiper/props.ts +30 -0
- package/components/hy-swiper/typing.d.ts +107 -0
- package/components/hy-switch/hy-switch.vue +168 -0
- package/components/hy-switch/props.ts +16 -0
- package/components/hy-switch/typing.d.ts +48 -0
- package/components/hy-tabs/hy-tabs.vue +416 -0
- package/components/hy-tabs/props.ts +26 -0
- package/components/hy-tabs/typing.d.ts +86 -0
- package/components/hy-tag/hy-tag.vue +374 -0
- package/components/hy-tag/props.ts +22 -0
- package/components/hy-tag/typing.d.ts +76 -0
- package/components/hy-textarea/hy-textarea.vue +229 -0
- package/components/hy-textarea/props.ts +26 -0
- package/components/hy-textarea/typing.d.ts +27 -0
- package/components/hy-tooltip/hy-tooltip.vue +332 -0
- package/components/hy-tooltip/props.ts +17 -0
- package/components/hy-tooltip/typing.d.ts +52 -0
- package/components/hy-transition/hy-transition.vue +150 -0
- package/components/hy-transition/index.scss +113 -0
- package/components/hy-transition/props.ts +10 -0
- package/components/hy-transition/typing.d.ts +36 -0
- package/components/hy-upload/hy-upload.vue +557 -0
- package/components/hy-upload/props.ts +29 -0
- package/components/hy-upload/typing.d.ts +147 -0
- package/components/hy-warn/hy-warn.vue +228 -0
- package/components/hy-warn/props.ts +14 -0
- package/components/hy-warn/typing.d.ts +40 -0
- package/components/hy-waterfall/hy-waterfall.vue +51 -0
- package/components/hy-waterfall/props.ts +10 -0
- package/components/hy-waterfall/typing.d.ts +20 -0
- package/components/index.ts +162 -0
- package/components/message/TheMessage.vue +169 -0
- package/components/message/index.ts +54 -0
- package/components/u-form/form.js +22 -0
- package/components/u-form/hy-form.vue +324 -0
- package/components/u-form/props.js +49 -0
- package/components/u-form/schema.js +1451 -0
- package/components/u-form/u-form.vue +267 -0
- package/components/u-form/utils.js +65 -0
- package/components/u-form-item/formItem.js +24 -0
- package/components/u-form-item/hy-form-item.vue +360 -0
- package/components/u-form-item/props.js +57 -0
- package/components/u-form-item/u-form-item.vue +294 -0
- package/components/yk-dialog/yk-dialog.vue +129 -0
- package/components/yk-tabbar/props.ts +49 -0
- package/components/yk-tabbar/yk-tabbar.vue +224 -0
- package/config/color.ts +6 -0
- package/config/icon.ts +366 -0
- package/config/index.ts +2 -0
- package/global/index.ts +6 -0
- package/global/register-properties.ts +37 -0
- package/index.ts +8 -0
- package/libs/css/common.scss +0 -0
- package/libs/css/iconfont.css +379 -0
- package/libs/css/iconfont.ttf +0 -0
- package/libs/css/mixin.scss +15 -0
- package/package.json +42 -0
- package/public/icons/error.png +0 -0
- package/public/icons/success.png +0 -0
- package/public/icons/warning.png +0 -0
- package/store/index.ts +1 -0
- package/store/userInfo.ts +25 -0
- package/theme.scss +94 -0
- package/typing/index.ts +7 -0
- package/typing/modules/common.d.ts +50 -0
- package/typing/modules/dialog.ts +17 -0
- package/typing/modules/enum.ts +67 -0
- package/typing/modules/form.ts +161 -0
- package/typing/modules/http.ts +68 -0
- package/typing/modules/icon.d.ts +366 -0
- package/typing/modules/img.ts +15 -0
- package/typing/modules/rect.ts +10 -0
- package/utils/address.json +5890 -0
- package/utils/base64.ts +119 -0
- package/utils/index.ts +3 -0
- package/utils/inside.ts +310 -0
- package/utils/utils.ts +446 -0
|
@@ -0,0 +1,394 @@
|
|
|
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
|
+
: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
|
+
class="hy-button hy-reset-button"
|
|
25
|
+
:style="[baseColor, customStyle]"
|
|
26
|
+
@tap="clickHandler"
|
|
27
|
+
:class="bemClass"
|
|
28
|
+
>
|
|
29
|
+
<template v-if="loading">
|
|
30
|
+
<hy-icon
|
|
31
|
+
:mode="loadingMode"
|
|
32
|
+
:is-rotate="true"
|
|
33
|
+
:name="IconConfig.LOADING"
|
|
34
|
+
:size="loadingSize * 1.15"
|
|
35
|
+
:color="loadingColor"
|
|
36
|
+
></hy-icon>
|
|
37
|
+
<text
|
|
38
|
+
class="hy-button__loading-text"
|
|
39
|
+
:style="[{ fontSize: textSize + 'px' }]"
|
|
40
|
+
>{{ loadingText || text }}</text
|
|
41
|
+
>
|
|
42
|
+
</template>
|
|
43
|
+
<template v-else>
|
|
44
|
+
<hy-icon
|
|
45
|
+
v-if="icon"
|
|
46
|
+
:name="icon"
|
|
47
|
+
:color="iconColorCom"
|
|
48
|
+
:size="textSize * 1.35"
|
|
49
|
+
:customStyle="{ marginRight: '2px' }"
|
|
50
|
+
></hy-icon>
|
|
51
|
+
<slot>
|
|
52
|
+
<text
|
|
53
|
+
class="hy-button__text"
|
|
54
|
+
:style="[{ fontSize: textSize + 'px' }]"
|
|
55
|
+
>{{ text }}</text
|
|
56
|
+
>
|
|
57
|
+
</slot>
|
|
58
|
+
</template>
|
|
59
|
+
</button>
|
|
60
|
+
<!-- #endif -->
|
|
61
|
+
|
|
62
|
+
<!-- #ifdef APP-NVUE -->
|
|
63
|
+
<view
|
|
64
|
+
:hover-start-time="Number(hoverStartTime)"
|
|
65
|
+
:hover-stay-time="Number(hoverStayTime)"
|
|
66
|
+
class="hy-button"
|
|
67
|
+
:hover-class="
|
|
68
|
+
!disabled && !loading && !color && (plain || type === 'info')
|
|
69
|
+
? 'hy-button--active--plain'
|
|
70
|
+
: !disabled && !loading && !plain
|
|
71
|
+
? 'hy-button--active'
|
|
72
|
+
: ''
|
|
73
|
+
"
|
|
74
|
+
@tap="clickHandler"
|
|
75
|
+
:class="bemClass"
|
|
76
|
+
:style="[baseColor, customStyle]"
|
|
77
|
+
>
|
|
78
|
+
<template v-if="loading">
|
|
79
|
+
<up-loading-icon
|
|
80
|
+
:mode="loadingMode"
|
|
81
|
+
:size="loadingSize * 1.15"
|
|
82
|
+
:color="loadingColor"
|
|
83
|
+
></up-loading-icon>
|
|
84
|
+
<text
|
|
85
|
+
class="hy-button__loading-text"
|
|
86
|
+
:style="[nvueTextStyle]"
|
|
87
|
+
:class="[plain && `hy-button__text--plain--${type}`]"
|
|
88
|
+
>{{ loadingText || text }}</text
|
|
89
|
+
>
|
|
90
|
+
</template>
|
|
91
|
+
<template v-else>
|
|
92
|
+
<HyIcon
|
|
93
|
+
v-if="icon"
|
|
94
|
+
:name="icon"
|
|
95
|
+
:color="iconColorCom"
|
|
96
|
+
:size="textSize * 1.35"
|
|
97
|
+
></HyIcon>
|
|
98
|
+
<text
|
|
99
|
+
class="hy-button__text"
|
|
100
|
+
:style="[
|
|
101
|
+
{
|
|
102
|
+
marginLeft: icon ? '2px' : 0
|
|
103
|
+
},
|
|
104
|
+
nvueTextStyle
|
|
105
|
+
]"
|
|
106
|
+
:class="[plain && `hy-button__text--plain--${type}`]"
|
|
107
|
+
>{{ text }}</text
|
|
108
|
+
>
|
|
109
|
+
</template>
|
|
110
|
+
</view>
|
|
111
|
+
<!-- #endif -->
|
|
112
|
+
</template>
|
|
113
|
+
|
|
114
|
+
<script setup lang="ts">
|
|
115
|
+
import { computed, CSSProperties, toRefs } from "vue";
|
|
116
|
+
import { bem, throttle } from "../../utils";
|
|
117
|
+
import defaultProps from "./props";
|
|
118
|
+
import { ColorConfig, IconConfig } from "../../config";
|
|
119
|
+
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
120
|
+
import IProps from "./typing";
|
|
121
|
+
|
|
122
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
123
|
+
const {
|
|
124
|
+
disabled,
|
|
125
|
+
loading,
|
|
126
|
+
throttleTime,
|
|
127
|
+
stop,
|
|
128
|
+
size,
|
|
129
|
+
type,
|
|
130
|
+
plain,
|
|
131
|
+
color,
|
|
132
|
+
iconColor
|
|
133
|
+
} = toRefs(props);
|
|
134
|
+
const emit = defineEmits([
|
|
135
|
+
"click",
|
|
136
|
+
"getphonenumber",
|
|
137
|
+
"getuserinfo",
|
|
138
|
+
"error",
|
|
139
|
+
"opensetting",
|
|
140
|
+
"launchapp",
|
|
141
|
+
"agreeprivacyauthorization"
|
|
142
|
+
]);
|
|
143
|
+
|
|
144
|
+
const textColor = (ColorConfig as any)[type.value];
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @description 生成bem风格的类名
|
|
148
|
+
*/
|
|
149
|
+
const bemClass = computed(() => {
|
|
150
|
+
// this.bem为一个computed变量,在mixin中
|
|
151
|
+
if (!color.value) {
|
|
152
|
+
return bem(
|
|
153
|
+
"button",
|
|
154
|
+
props,
|
|
155
|
+
["type", "shape", "size"],
|
|
156
|
+
["disabled", "plain", "hairline"]
|
|
157
|
+
);
|
|
158
|
+
} else {
|
|
159
|
+
// 由于nvue的原因,在有color参数时,不需要传入type,否则会生成type相关的类型,影响最终的样式
|
|
160
|
+
return bem(
|
|
161
|
+
"button",
|
|
162
|
+
props,
|
|
163
|
+
["shape", "size"],
|
|
164
|
+
["disabled", "plain", "hairline"]
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const loadingColor = computed(() => {
|
|
170
|
+
if (plain.value) {
|
|
171
|
+
// 如果有设置color值,则用color值,否则使用type主题颜色
|
|
172
|
+
return color.value ? color.value : (ColorConfig as any)[type.value];
|
|
173
|
+
}
|
|
174
|
+
if (type.value === "info") {
|
|
175
|
+
return "#c9c9c9";
|
|
176
|
+
}
|
|
177
|
+
return "#fff";
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const iconColorCom = computed((): string => {
|
|
181
|
+
// 如果是镂空状态,设置了color就用color值,否则使用主题颜色,
|
|
182
|
+
// u-icon的color能接受一个主题颜色的值
|
|
183
|
+
if (iconColor.value) return iconColor.value;
|
|
184
|
+
if (plain.value) {
|
|
185
|
+
return color.value ? color.value : type.value;
|
|
186
|
+
} else {
|
|
187
|
+
return type.value === "info" ? "#000000" : "#ffffff";
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
const baseColor = computed((): CSSProperties => {
|
|
191
|
+
let style: CSSProperties = {};
|
|
192
|
+
if (color.value) {
|
|
193
|
+
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
|
|
194
|
+
style.color = plain.value ? color.value : "white";
|
|
195
|
+
if (!plain.value) {
|
|
196
|
+
// 非镂空,背景色使用自定义的颜色
|
|
197
|
+
style["background-color"] = color.value;
|
|
198
|
+
}
|
|
199
|
+
if (color.value.indexOf("gradient") !== -1) {
|
|
200
|
+
// 如果自定义的颜色为渐变色,不显示边框,以及通过backgroundImage设置渐变色
|
|
201
|
+
// weex文档说明可以写borderWidth的形式,为什么这里需要分开写?
|
|
202
|
+
// 因为weex是阿里巴巴为了部门业绩考核而做的你懂的东西,所以需要这么写才有效
|
|
203
|
+
style.borderTopWidth = 0;
|
|
204
|
+
style.borderRightWidth = 0;
|
|
205
|
+
style.borderBottomWidth = 0;
|
|
206
|
+
style.borderLeftWidth = 0;
|
|
207
|
+
if (!plain.value) {
|
|
208
|
+
style.backgroundImage = color.value;
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
// 非渐变色,则设置边框相关的属性
|
|
212
|
+
style.borderColor = color.value;
|
|
213
|
+
style.borderWidth = "1px";
|
|
214
|
+
style.borderStyle = "solid";
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return style;
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
// nvue版本按钮的字体不会继承父组件的颜色,需要对每一个text组件进行单独的设置
|
|
221
|
+
const nvueTextStyle = computed((): CSSProperties => {
|
|
222
|
+
let style: CSSProperties = {};
|
|
223
|
+
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
|
|
224
|
+
if (type.value === "info") {
|
|
225
|
+
style.color = "#323233";
|
|
226
|
+
}
|
|
227
|
+
if (color.value) {
|
|
228
|
+
style.color = plain.value ? color.value : "white";
|
|
229
|
+
}
|
|
230
|
+
style.fontSize = textSize.value + "px";
|
|
231
|
+
return style;
|
|
232
|
+
});
|
|
233
|
+
/**
|
|
234
|
+
* @description 字体大小
|
|
235
|
+
* */
|
|
236
|
+
const textSize = computed((): number => {
|
|
237
|
+
let fontSize = 14;
|
|
238
|
+
if (size.value === "large") fontSize = 16;
|
|
239
|
+
if (size.value === "normal") fontSize = 14;
|
|
240
|
+
if (size.value === "small") fontSize = 12;
|
|
241
|
+
if (size.value === "mini") fontSize = 10;
|
|
242
|
+
return fontSize;
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
const clickHandler = (e: any) => {
|
|
246
|
+
// 非禁止并且非加载中,才能点击
|
|
247
|
+
if (!disabled.value && !loading.value) {
|
|
248
|
+
// 进行节流控制,每this.throttle毫秒内,只在开始处执行
|
|
249
|
+
throttle(() => {
|
|
250
|
+
emit("click", e);
|
|
251
|
+
}, throttleTime.value);
|
|
252
|
+
}
|
|
253
|
+
// 是否阻止事件传播
|
|
254
|
+
stop.value && e.stopPropagation();
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
const getphonenumber = (e: any) => {
|
|
258
|
+
emit("getphonenumber", e);
|
|
259
|
+
};
|
|
260
|
+
const getuserinfo = (e: any) => {
|
|
261
|
+
emit("getuserinfo", e);
|
|
262
|
+
};
|
|
263
|
+
const error = (e: any) => {
|
|
264
|
+
emit("error", e);
|
|
265
|
+
};
|
|
266
|
+
const opensetting = (e: any) => {
|
|
267
|
+
emit("opensetting", e);
|
|
268
|
+
};
|
|
269
|
+
const launchapp = (e: any) => {
|
|
270
|
+
emit("launchapp", e);
|
|
271
|
+
};
|
|
272
|
+
const agreeprivacyauthorization = (e: any) => {
|
|
273
|
+
emit("agreeprivacyauthorization", e);
|
|
274
|
+
};
|
|
275
|
+
</script>
|
|
276
|
+
|
|
277
|
+
<style lang="scss" scoped>
|
|
278
|
+
@import "../../libs/css/mixin.scss";
|
|
279
|
+
@import "../../theme.scss";
|
|
280
|
+
|
|
281
|
+
.hy-button {
|
|
282
|
+
height: 40px;
|
|
283
|
+
position: relative;
|
|
284
|
+
align-items: center;
|
|
285
|
+
justify-content: center;
|
|
286
|
+
@include flex;
|
|
287
|
+
/* #ifndef APP-NVUE */
|
|
288
|
+
box-sizing: border-box;
|
|
289
|
+
/* #endif */
|
|
290
|
+
flex-direction: row;
|
|
291
|
+
|
|
292
|
+
&__text {
|
|
293
|
+
font-size: 15px;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
&__loading-text {
|
|
297
|
+
font-size: 15px;
|
|
298
|
+
margin-left: 4px;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
&--large {
|
|
302
|
+
/* #ifndef APP-NVUE */
|
|
303
|
+
width: 100%;
|
|
304
|
+
/* #endif */
|
|
305
|
+
height: 50px;
|
|
306
|
+
padding: 0 15px;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
&--normal {
|
|
310
|
+
padding: 0 12px;
|
|
311
|
+
font-size: 14px;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
&--small {
|
|
315
|
+
/* #ifndef APP-NVUE */
|
|
316
|
+
min-width: 60px;
|
|
317
|
+
/* #endif */
|
|
318
|
+
height: 80px;
|
|
319
|
+
padding: 0 8px;
|
|
320
|
+
font-size: 12px;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
&--mini {
|
|
324
|
+
height: 22px;
|
|
325
|
+
font-size: 10px;
|
|
326
|
+
/* #ifndef APP-NVUE */
|
|
327
|
+
min-width: 50px;
|
|
328
|
+
/* #endif */
|
|
329
|
+
padding: 0 8px;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
&--disabled {
|
|
333
|
+
opacity: 0.5;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
&--info {
|
|
337
|
+
color: #323233;
|
|
338
|
+
background-color: #fff;
|
|
339
|
+
border: 1px solid #ebedf0;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
&--success {
|
|
343
|
+
color: #fff;
|
|
344
|
+
background-color: $hy-success;
|
|
345
|
+
border: 1px solid $hy-success;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
&--primary {
|
|
349
|
+
color: #fff;
|
|
350
|
+
background-color: $hy-primary;
|
|
351
|
+
border: 1px solid $hy-primary;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
&--error {
|
|
355
|
+
color: #fff;
|
|
356
|
+
background-color: $hy-error;
|
|
357
|
+
border: 1px solid $hy-error;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
&--warning {
|
|
361
|
+
color: #fff;
|
|
362
|
+
background-color: $hy-warning;
|
|
363
|
+
border: 1px solid $hy-warning;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
&--block {
|
|
367
|
+
@include flex;
|
|
368
|
+
width: 100%;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
&--circle {
|
|
372
|
+
border-radius: 100px;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
&--square {
|
|
376
|
+
border-radius: 3px;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
&__icon {
|
|
380
|
+
min-width: 1em;
|
|
381
|
+
line-height: inherit !important;
|
|
382
|
+
vertical-align: top;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
&--plain {
|
|
386
|
+
color: v-bind(textColor);
|
|
387
|
+
background-color: #fff;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
&--hairline {
|
|
391
|
+
border-width: 0.5;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
</style>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import IProps from "./typing";
|
|
2
|
+
import type { CSSProperties } from "vue";
|
|
3
|
+
|
|
4
|
+
const defaultProps: IProps = {
|
|
5
|
+
hairline: false,
|
|
6
|
+
type: "info",
|
|
7
|
+
size: "normal",
|
|
8
|
+
shape: "square",
|
|
9
|
+
plain: false,
|
|
10
|
+
disabled: false,
|
|
11
|
+
loading: false,
|
|
12
|
+
loadingText: "",
|
|
13
|
+
loadingMode: "spinner",
|
|
14
|
+
loadingSize: 13,
|
|
15
|
+
openType: "",
|
|
16
|
+
formType: "",
|
|
17
|
+
appParameter: "",
|
|
18
|
+
hoverStopPropagation: true,
|
|
19
|
+
lang: "en",
|
|
20
|
+
sessionFrom: "",
|
|
21
|
+
sendMessageTitle: "",
|
|
22
|
+
sendMessagePath: "",
|
|
23
|
+
sendMessageImg: "",
|
|
24
|
+
showMessageCard: false,
|
|
25
|
+
dataName: "",
|
|
26
|
+
throttleTime: 0,
|
|
27
|
+
hoverStartTime: 0,
|
|
28
|
+
hoverStayTime: 200,
|
|
29
|
+
text: "",
|
|
30
|
+
icon: "",
|
|
31
|
+
iconColor: "",
|
|
32
|
+
color: "",
|
|
33
|
+
stop: true
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default defaultProps;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { CSSProperties } from "vue";
|
|
2
|
+
|
|
3
|
+
export default interface IProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description 是否显示按钮的细边框 (默认 true )
|
|
6
|
+
* */
|
|
7
|
+
hairline?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* @description 按钮的预置样式,info,primary,error,warning,success (默认 'info' )
|
|
10
|
+
* */
|
|
11
|
+
type?: HyApp.ThemeType;
|
|
12
|
+
/**
|
|
13
|
+
* @description 按钮尺寸,large,normal,mini (默认 normal)
|
|
14
|
+
* */
|
|
15
|
+
size?: "normal" | "large" | "small" | "mini";
|
|
16
|
+
/**
|
|
17
|
+
* @description 按钮形状,circle(两边为半圆),square(带圆角) (默认 'square' )
|
|
18
|
+
* */
|
|
19
|
+
shape?: HyApp.ShapeType;
|
|
20
|
+
/**
|
|
21
|
+
* @description 按钮是否镂空,背景色透明 (默认 false)
|
|
22
|
+
* */
|
|
23
|
+
plain?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* @description 是否禁用 (默认 false)
|
|
26
|
+
* */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* @description 按钮名称前是否带 loading 图标(App-nvue 平台,在 ios 上为雪花,Android上为圆圈) (默认 false)
|
|
30
|
+
* */
|
|
31
|
+
loading?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @description 加载中提示文字
|
|
34
|
+
* */
|
|
35
|
+
loadingText?: string;
|
|
36
|
+
/**
|
|
37
|
+
* @description 加载状态图标类型 (默认 'spinner' )
|
|
38
|
+
* */
|
|
39
|
+
loadingMode?: "spinner" | "text";
|
|
40
|
+
/**
|
|
41
|
+
* @description 加载图标大小 (默认 13 )
|
|
42
|
+
* */
|
|
43
|
+
loadingSize?: number;
|
|
44
|
+
/**
|
|
45
|
+
* @description 开放能力,具体请看uniapp稳定关于button组件部分说明
|
|
46
|
+
* */
|
|
47
|
+
openType?: string;
|
|
48
|
+
/**
|
|
49
|
+
* @description 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件
|
|
50
|
+
* */
|
|
51
|
+
formType?: string;
|
|
52
|
+
/**
|
|
53
|
+
* @description 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 (注:只微信小程序、QQ小程序有效)
|
|
54
|
+
* */
|
|
55
|
+
appParameter?: string;
|
|
56
|
+
/**
|
|
57
|
+
* @description 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效(默认 true )
|
|
58
|
+
* */
|
|
59
|
+
hoverStopPropagation?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* @description 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文(默认 en )
|
|
62
|
+
* */
|
|
63
|
+
lang?: string;
|
|
64
|
+
/**
|
|
65
|
+
* @description 会话来源,openType="contact"时有效
|
|
66
|
+
* */
|
|
67
|
+
sessionFrom?: string;
|
|
68
|
+
/**
|
|
69
|
+
* @description 会话内消息卡片标题,openType="contact"时有效
|
|
70
|
+
* */
|
|
71
|
+
sendMessageTitle?: string;
|
|
72
|
+
/**
|
|
73
|
+
* @description 会话内消息卡片点击跳转小程序路径,openType="contact"时有效
|
|
74
|
+
* */
|
|
75
|
+
sendMessagePath?: string;
|
|
76
|
+
/**
|
|
77
|
+
* @description 会话内消息卡片图片,openType="contact"时有效
|
|
78
|
+
* */
|
|
79
|
+
sendMessageImg?: string;
|
|
80
|
+
/**
|
|
81
|
+
* @description 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效(默认false)
|
|
82
|
+
* */
|
|
83
|
+
showMessageCard?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* @description 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取
|
|
86
|
+
* */
|
|
87
|
+
dataName?: string;
|
|
88
|
+
/**
|
|
89
|
+
* @description 节流时间,一定时间内只能触发一次 (默认 0 )
|
|
90
|
+
* */
|
|
91
|
+
throttleTime?: number;
|
|
92
|
+
/**
|
|
93
|
+
* @description 按住后多久出现点击态,单位毫秒 (默认 0 )
|
|
94
|
+
* */
|
|
95
|
+
hoverStartTime?: number;
|
|
96
|
+
/**
|
|
97
|
+
* @description 手指松开后点击态保留时间,单位毫秒 (默认 200 )
|
|
98
|
+
* */
|
|
99
|
+
hoverStayTime?: number;
|
|
100
|
+
/**
|
|
101
|
+
* @description 按钮文字,之所以通过props传入,是因为slot传入的话(注:nvue中无法控制文字的样式)
|
|
102
|
+
* */
|
|
103
|
+
text?: string;
|
|
104
|
+
/**
|
|
105
|
+
* @description 按钮图标
|
|
106
|
+
* */
|
|
107
|
+
icon?: string | HyIconConfig;
|
|
108
|
+
/**
|
|
109
|
+
* @description 按钮图标颜色
|
|
110
|
+
* */
|
|
111
|
+
iconColor?: string;
|
|
112
|
+
/**
|
|
113
|
+
* @description 按钮颜色,支持传入linear-gradient渐变色
|
|
114
|
+
* */
|
|
115
|
+
color?: string;
|
|
116
|
+
/**
|
|
117
|
+
* @description 阻止事件冒泡
|
|
118
|
+
* */
|
|
119
|
+
stop?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* @description 定义需要用到的外部样式
|
|
122
|
+
* @note 类型问题
|
|
123
|
+
* */
|
|
124
|
+
customStyle?: CSSProperties;
|
|
125
|
+
}
|