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,374 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<HyTransition mode="fade" :show="show" style="display: inline-flex">
|
|
3
|
+
<view class="hy-tag__wrapper cursor-pointer">
|
|
4
|
+
<view :class="tagClass" @tap.stop="clickHandler" :style="tagStyle">
|
|
5
|
+
<slot name="icon">
|
|
6
|
+
<HyIcon
|
|
7
|
+
v-if="icon"
|
|
8
|
+
:color="hyIconColor"
|
|
9
|
+
:name="icon"
|
|
10
|
+
:size="hyIconSize"
|
|
11
|
+
:customStyle="{ marginRight: '3px' }"
|
|
12
|
+
></HyIcon>
|
|
13
|
+
</slot>
|
|
14
|
+
<text :class="textClass">
|
|
15
|
+
<slot>
|
|
16
|
+
{{ text }}
|
|
17
|
+
</slot>
|
|
18
|
+
</text>
|
|
19
|
+
</view>
|
|
20
|
+
<view
|
|
21
|
+
:class="['hy-tag__close', `hy-tag__close--${size}`]"
|
|
22
|
+
v-if="closable"
|
|
23
|
+
@tap.stop="closeHandler"
|
|
24
|
+
:style="{ backgroundColor: closeColor }"
|
|
25
|
+
>
|
|
26
|
+
<HyIcon
|
|
27
|
+
:name="IconConfig.CLOSE"
|
|
28
|
+
:size="closeSize"
|
|
29
|
+
color="#ffffff"
|
|
30
|
+
></HyIcon>
|
|
31
|
+
</view>
|
|
32
|
+
</view>
|
|
33
|
+
</HyTransition>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup lang="ts">
|
|
37
|
+
import { computed, CSSProperties, toRefs } from "vue";
|
|
38
|
+
import defaultProps from "./props";
|
|
39
|
+
import IProps from "./typing";
|
|
40
|
+
import HyTransition from "../hy-transition/hy-transition.vue";
|
|
41
|
+
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
42
|
+
import { IconConfig } from "../../config";
|
|
43
|
+
|
|
44
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
45
|
+
const {
|
|
46
|
+
text,
|
|
47
|
+
name,
|
|
48
|
+
shape,
|
|
49
|
+
plain,
|
|
50
|
+
type,
|
|
51
|
+
size,
|
|
52
|
+
plainFill,
|
|
53
|
+
closable,
|
|
54
|
+
bgColor,
|
|
55
|
+
color,
|
|
56
|
+
borderColor,
|
|
57
|
+
iconColor,
|
|
58
|
+
disabled
|
|
59
|
+
} = toRefs(props);
|
|
60
|
+
const emit = defineEmits(["click", "close"]);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @description tag类名
|
|
64
|
+
* */
|
|
65
|
+
const tagClass = computed((): string[] => {
|
|
66
|
+
let classes = ["hy-tag", `hy-tag--${shape.value}`, `hy-tag--${size.value}`];
|
|
67
|
+
if (disabled.value) {
|
|
68
|
+
classes.push("hy-tag--disabled");
|
|
69
|
+
} else {
|
|
70
|
+
const arr = [
|
|
71
|
+
!plain.value && `hy-tag--${type.value}`,
|
|
72
|
+
plain.value && `hy-tag--${type.value}--plain`,
|
|
73
|
+
plain.value && plainFill.value && `hy-tag--${type.value}--plain--fill`
|
|
74
|
+
].filter(Boolean);
|
|
75
|
+
classes = classes.concat(arr as string[]);
|
|
76
|
+
}
|
|
77
|
+
return classes;
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
* @description tag样式
|
|
81
|
+
* */
|
|
82
|
+
const tagStyle = computed<CSSProperties>(() => {
|
|
83
|
+
const style: CSSProperties = {
|
|
84
|
+
marginRight: closable ? "10px" : 0,
|
|
85
|
+
marginTop: closable ? "10px" : 0
|
|
86
|
+
};
|
|
87
|
+
if (bgColor.value) {
|
|
88
|
+
style.backgroundColor = bgColor.value;
|
|
89
|
+
}
|
|
90
|
+
if (color.value) {
|
|
91
|
+
style.color = color.value;
|
|
92
|
+
}
|
|
93
|
+
if (borderColor.value) {
|
|
94
|
+
style.borderColor = borderColor.value;
|
|
95
|
+
}
|
|
96
|
+
return style;
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @description 文本类名
|
|
101
|
+
* */
|
|
102
|
+
const textClass = computed((): string[] => {
|
|
103
|
+
return [
|
|
104
|
+
`hy-tag__text`,
|
|
105
|
+
`hy-tag__text--${type.value}`,
|
|
106
|
+
plain.value && `hy-tag__text--${type.value}--plain`,
|
|
107
|
+
`hy-tag__text--${size.value}`
|
|
108
|
+
].filter(Boolean) as string[];
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @description 关闭图标icon大小
|
|
113
|
+
*/
|
|
114
|
+
const closeSize = computed(() => {
|
|
115
|
+
return size.value === "large" ? 15 : size.value === "medium" ? 13 : 11;
|
|
116
|
+
});
|
|
117
|
+
/**
|
|
118
|
+
* @description 图标大小
|
|
119
|
+
* */
|
|
120
|
+
const hyIconSize = computed(() => {
|
|
121
|
+
if (props.iconSize) {
|
|
122
|
+
return props.iconSize;
|
|
123
|
+
} else {
|
|
124
|
+
return size.value === "large" ? 18 : size.value === "medium" ? 14 : 10;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
/**
|
|
128
|
+
* @description 图标颜色
|
|
129
|
+
* */
|
|
130
|
+
const hyIconColor = computed(() => {
|
|
131
|
+
return iconColor.value
|
|
132
|
+
? iconColor.value
|
|
133
|
+
: plain.value
|
|
134
|
+
? type.value
|
|
135
|
+
: "#ffffff";
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @description 点击关闭按钮
|
|
140
|
+
* */
|
|
141
|
+
const closeHandler = () => {
|
|
142
|
+
if (!disabled.value) {
|
|
143
|
+
emit("close", text.value);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* @description 点击标签
|
|
148
|
+
* */
|
|
149
|
+
const clickHandler = () => {
|
|
150
|
+
if (!disabled.value) {
|
|
151
|
+
emit("click", {
|
|
152
|
+
value: text.value,
|
|
153
|
+
name: name.value
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
</script>
|
|
158
|
+
|
|
159
|
+
<style lang="scss" scoped>
|
|
160
|
+
@import "../../libs/css/mixin.scss";
|
|
161
|
+
@import "../../theme.scss";
|
|
162
|
+
|
|
163
|
+
.hy-tag {
|
|
164
|
+
@include flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
border-style: solid;
|
|
167
|
+
|
|
168
|
+
&__wrapper {
|
|
169
|
+
position: relative;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/*禁用*/
|
|
173
|
+
&--disabled {
|
|
174
|
+
background-color: $hy-color-disable-bg;
|
|
175
|
+
color: $hy-text-color-disable;
|
|
176
|
+
border: 1px solid $hy-color-disable-icon;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&--circle {
|
|
180
|
+
border-radius: 100px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&--square {
|
|
184
|
+
border-radius: 3px;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
&__icon {
|
|
188
|
+
margin-right: 4px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&__text {
|
|
192
|
+
&--small {
|
|
193
|
+
font-size: $hy-font-size-sm;
|
|
194
|
+
line-height: $hy-font-size-sm;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
&--medium {
|
|
198
|
+
font-size: $hy-font-size-base;
|
|
199
|
+
line-height: $hy-font-size-base;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&--large {
|
|
203
|
+
font-size: $hy-font-size-lg;
|
|
204
|
+
line-height: $hy-font-size-lg;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
&--small {
|
|
209
|
+
height: 22px;
|
|
210
|
+
line-height: 22px;
|
|
211
|
+
padding: 0 5px;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&--medium {
|
|
215
|
+
height: 26px;
|
|
216
|
+
line-height: 22px;
|
|
217
|
+
padding: 0 10px;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
&--large {
|
|
221
|
+
height: 32px;
|
|
222
|
+
line-height: 32px;
|
|
223
|
+
padding: 0 15px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&--primary {
|
|
227
|
+
background-color: $hy-primary;
|
|
228
|
+
border-width: 1px;
|
|
229
|
+
border-color: $hy-primary;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
&--primary--plain {
|
|
233
|
+
border-width: 1px;
|
|
234
|
+
border-color: $hy-primary;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
&--primary--plain--fill {
|
|
238
|
+
background-color: #ecf5ff;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
&__text--primary {
|
|
242
|
+
color: #ffffff;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
&__text--primary--plain {
|
|
246
|
+
color: $hy-primary;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
&--error {
|
|
250
|
+
background-color: $hy-error;
|
|
251
|
+
border-width: 1px;
|
|
252
|
+
border-color: $hy-error;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
&--error--plain {
|
|
256
|
+
border-width: 1px;
|
|
257
|
+
border-color: $hy-error;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
&--error--plain--fill {
|
|
261
|
+
background-color: #fef0f0;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
&__text--error {
|
|
265
|
+
color: #ffffff;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
&__text--error--plain {
|
|
269
|
+
color: $hy-error;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
&--warning {
|
|
273
|
+
background-color: $hy-warning;
|
|
274
|
+
border-width: 1px;
|
|
275
|
+
border-color: $hy-warning;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
&--warning--plain {
|
|
279
|
+
border-width: 1px;
|
|
280
|
+
border-color: $hy-warning;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
&--warning--plain--fill {
|
|
284
|
+
background-color: #fdf6ec;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
&__text--warning {
|
|
288
|
+
color: #ffffff;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
&__text--warning--plain {
|
|
292
|
+
color: $hy-warning;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
&--success {
|
|
296
|
+
background-color: $hy-success;
|
|
297
|
+
border-width: 1px;
|
|
298
|
+
border-color: $hy-success;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
&--success--plain {
|
|
302
|
+
border-width: 1px;
|
|
303
|
+
border-color: $hy-success;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
&--success--plain--fill {
|
|
307
|
+
background-color: #f5fff0;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
&__text--success {
|
|
311
|
+
color: #ffffff;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
&__text--success--plain {
|
|
315
|
+
color: $hy-success;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
&--info {
|
|
319
|
+
background-color: $hy-info;
|
|
320
|
+
border-width: 1px;
|
|
321
|
+
border-color: $hy-info;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
&--info--plain {
|
|
325
|
+
border-width: 1px;
|
|
326
|
+
border-color: $hy-info;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
&--info--plain--fill {
|
|
330
|
+
background-color: #f4f4f5;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
&__text--info {
|
|
334
|
+
color: #ffffff;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
&__text--info--plain {
|
|
338
|
+
color: $hy-info;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
&__close {
|
|
342
|
+
position: absolute;
|
|
343
|
+
z-index: 999;
|
|
344
|
+
top: 10px;
|
|
345
|
+
right: 10px;
|
|
346
|
+
border-radius: 100px;
|
|
347
|
+
background-color: #c6c7cb;
|
|
348
|
+
@include flex(row);
|
|
349
|
+
align-items: center;
|
|
350
|
+
justify-content: center;
|
|
351
|
+
/* #ifndef APP-NVUE */
|
|
352
|
+
transform: scale(0.6) translate(80%, -80%);
|
|
353
|
+
/* #endif */
|
|
354
|
+
/* #ifdef APP-NVUE */
|
|
355
|
+
transform: scale(0.6) translate(50%, -50%);
|
|
356
|
+
/* #endif */
|
|
357
|
+
|
|
358
|
+
&--small {
|
|
359
|
+
width: 18px;
|
|
360
|
+
height: 18px;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
&--medium {
|
|
364
|
+
width: 22px;
|
|
365
|
+
height: 22px;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
&--large {
|
|
369
|
+
width: 25px;
|
|
370
|
+
height: 25px;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import IProps from "./typing";
|
|
2
|
+
|
|
3
|
+
const defaultProps: IProps = {
|
|
4
|
+
text: "",
|
|
5
|
+
name: "",
|
|
6
|
+
type: "primary",
|
|
7
|
+
disabled: false,
|
|
8
|
+
size: "medium",
|
|
9
|
+
shape: "square",
|
|
10
|
+
bgColor: "",
|
|
11
|
+
color: "",
|
|
12
|
+
borderColor: "",
|
|
13
|
+
closeColor: "#C6C7CB",
|
|
14
|
+
plainFill: false,
|
|
15
|
+
plain: false,
|
|
16
|
+
closable: false,
|
|
17
|
+
show: true,
|
|
18
|
+
icon: "",
|
|
19
|
+
iconColor: ""
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default defaultProps;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { CSSProperties } from "vue";
|
|
2
|
+
|
|
3
|
+
export default interface IProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description 标签的文字内容
|
|
6
|
+
* */
|
|
7
|
+
text: string | number;
|
|
8
|
+
/**
|
|
9
|
+
* @description 点击需要传得值
|
|
10
|
+
* */
|
|
11
|
+
name: string | number;
|
|
12
|
+
/**
|
|
13
|
+
* @description 标签类型info、primary、success、warning、error (默认 'primary' )
|
|
14
|
+
* */
|
|
15
|
+
type?: HyApp.ThemeType;
|
|
16
|
+
/**
|
|
17
|
+
* @description 禁用(默认 false )
|
|
18
|
+
* */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @description 标签的大小,large,medium,small (默认 'medium' )
|
|
22
|
+
* */
|
|
23
|
+
size?: HyApp.SizeType;
|
|
24
|
+
/**
|
|
25
|
+
* @description tag的形状,circle(两边半圆形), square(方形,带圆角)(默认 'square' )
|
|
26
|
+
* */
|
|
27
|
+
shape?: HyApp.ShapeType;
|
|
28
|
+
/**
|
|
29
|
+
* @description 背景颜色,默认为空字符串,即不处理
|
|
30
|
+
* */
|
|
31
|
+
bgColor?: string;
|
|
32
|
+
/**
|
|
33
|
+
* @description 标签字体颜色,默认为空字符串,即不处理
|
|
34
|
+
* */
|
|
35
|
+
color?: string;
|
|
36
|
+
/**
|
|
37
|
+
* @description 镂空形式标签的边框颜色
|
|
38
|
+
* */
|
|
39
|
+
borderColor?: string;
|
|
40
|
+
/**
|
|
41
|
+
* @description 关闭按钮图标的颜色(默认 #C6C7CB)
|
|
42
|
+
* */
|
|
43
|
+
closeColor?: string;
|
|
44
|
+
/**
|
|
45
|
+
* @description 镂空时是否填充背景色(默认 false )
|
|
46
|
+
* */
|
|
47
|
+
plainFill?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* @description 是否镂空(默认 false )
|
|
50
|
+
* */
|
|
51
|
+
plain?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* @description 是否可关闭,设置为true,文字右边会出现一个关闭图标(默认 false )
|
|
54
|
+
* */
|
|
55
|
+
closable?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* @description 标签显示与否(默认 true )
|
|
58
|
+
* */
|
|
59
|
+
show?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* @description 组件内置图标,或绝对路径的图片
|
|
62
|
+
* */
|
|
63
|
+
icon?: string;
|
|
64
|
+
/**
|
|
65
|
+
* @description icon颜色
|
|
66
|
+
* */
|
|
67
|
+
iconColor?: string;
|
|
68
|
+
/**
|
|
69
|
+
* @description icon大小
|
|
70
|
+
* */
|
|
71
|
+
iconSize?: string | number;
|
|
72
|
+
/**
|
|
73
|
+
* @description 定义需要用到的外部样式
|
|
74
|
+
* */
|
|
75
|
+
customStyle?: CSSProperties;
|
|
76
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="hy-textarea"
|
|
4
|
+
:class="textareaClass"
|
|
5
|
+
:style="[textareaStyle, borderStyle(isFocus)]"
|
|
6
|
+
>
|
|
7
|
+
<textarea
|
|
8
|
+
class="hy-textarea__field"
|
|
9
|
+
:value="innerValue"
|
|
10
|
+
:style="{ height: addUnit(height) }"
|
|
11
|
+
:placeholder="placeholder"
|
|
12
|
+
:placeholder-style="placeholderStyle"
|
|
13
|
+
:placeholder-class="placeholderClass"
|
|
14
|
+
:disabled="disabled"
|
|
15
|
+
:focus="focus"
|
|
16
|
+
:autoHeight="autoHeight"
|
|
17
|
+
:fixed="fixed"
|
|
18
|
+
:cursorSpacing="cursorSpacing"
|
|
19
|
+
:cursor="cursor"
|
|
20
|
+
:showConfirmBar="showConfirmBar"
|
|
21
|
+
:selectionStart="selectionStart"
|
|
22
|
+
:selectionEnd="selectionEnd"
|
|
23
|
+
:adjustPosition="adjustPosition"
|
|
24
|
+
:disableDefaultPadding="disableDefaultPadding"
|
|
25
|
+
:holdKeyboard="holdKeyboard"
|
|
26
|
+
:maxlength="maxlength"
|
|
27
|
+
:confirm-type="confirmType"
|
|
28
|
+
@focus="onFocus"
|
|
29
|
+
@blur="onBlur"
|
|
30
|
+
@linechange="onLinechange"
|
|
31
|
+
@input="onInput"
|
|
32
|
+
@confirm="onConfirm"
|
|
33
|
+
@keyboardheightchange="onKeyboardheightchange"
|
|
34
|
+
></textarea>
|
|
35
|
+
<!-- #ifndef MP-ALIPAY -->
|
|
36
|
+
<text
|
|
37
|
+
class="hy-textarea__count"
|
|
38
|
+
:style="{
|
|
39
|
+
'background-color': disabled ? 'transparent' : '#fff'
|
|
40
|
+
}"
|
|
41
|
+
v-if="count"
|
|
42
|
+
>{{ innerValue.length }}/{{ maxlength }}</text
|
|
43
|
+
>
|
|
44
|
+
<!-- #endif -->
|
|
45
|
+
</view>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script setup lang="ts">
|
|
49
|
+
import { computed, CSSProperties, ref, toRefs, watch, nextTick } from "vue";
|
|
50
|
+
import IProps from "./typing";
|
|
51
|
+
import defaultProps from "./props";
|
|
52
|
+
import { ColorConfig } from "../../config";
|
|
53
|
+
import { addUnit } from "../../utils";
|
|
54
|
+
|
|
55
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
56
|
+
const { modelValue, customStyle, border, disabled, formatter } = toRefs(props);
|
|
57
|
+
const emit = defineEmits([
|
|
58
|
+
"update:modelValue",
|
|
59
|
+
"linechange",
|
|
60
|
+
"focus",
|
|
61
|
+
"blur",
|
|
62
|
+
"change",
|
|
63
|
+
"confirm",
|
|
64
|
+
"keyboardheightchange"
|
|
65
|
+
]);
|
|
66
|
+
|
|
67
|
+
// 输入框的值
|
|
68
|
+
const innerValue = ref<string>("");
|
|
69
|
+
// 是否处于获得焦点状态
|
|
70
|
+
const focused = ref<boolean>(false);
|
|
71
|
+
// value是否第一次变化,在watch中,由于加入immediate属性,会在第一次触发,此时不应该认为value发生了变化
|
|
72
|
+
const firstChange = ref<boolean>(true);
|
|
73
|
+
// value绑定值的变化是由内部还是外部引起的
|
|
74
|
+
const changeFromInner = ref<boolean>(false);
|
|
75
|
+
// 是否获取焦点
|
|
76
|
+
const isFocus = ref<boolean>(false);
|
|
77
|
+
// 过滤处理方法
|
|
78
|
+
let innerFormatter = (value: string) => value;
|
|
79
|
+
|
|
80
|
+
watch(
|
|
81
|
+
() => modelValue.value,
|
|
82
|
+
(newVal) => {
|
|
83
|
+
innerValue.value = newVal;
|
|
84
|
+
/* #ifdef H5 */
|
|
85
|
+
// 在H5中,外部value变化后,修改input中的值,不会触发@input事件,此时手动调用值变化方法
|
|
86
|
+
if (firstChange.value === false && changeFromInner.value === false) {
|
|
87
|
+
valueChange();
|
|
88
|
+
}
|
|
89
|
+
/* #endif */
|
|
90
|
+
firstChange.value = false;
|
|
91
|
+
// 重置changeFromInner的值为false,标识下一次引起默认为外部引起的
|
|
92
|
+
changeFromInner.value = false;
|
|
93
|
+
},
|
|
94
|
+
{ immediate: true }
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// 组件的类名
|
|
98
|
+
const textareaClass = computed(() => {
|
|
99
|
+
let classes: string[] = [];
|
|
100
|
+
border.value === "surround" &&
|
|
101
|
+
(classes = classes.concat(["hy-border", "hy-textarea--radius"]));
|
|
102
|
+
border.value === "bottom" &&
|
|
103
|
+
(classes = classes.concat(["hy-border__bottom", "hy-textarea--no-radius"]));
|
|
104
|
+
disabled.value && classes.push("hy-textarea--disabled");
|
|
105
|
+
return classes.join(" ");
|
|
106
|
+
});
|
|
107
|
+
// 组件的样式
|
|
108
|
+
const textareaStyle = computed(() => {
|
|
109
|
+
const style: CSSProperties = {};
|
|
110
|
+
|
|
111
|
+
return Object.assign(style, customStyle.value);
|
|
112
|
+
});
|
|
113
|
+
/**
|
|
114
|
+
* @description 边框颜色
|
|
115
|
+
* */
|
|
116
|
+
const borderStyle = computed(() => {
|
|
117
|
+
return (isFocus: boolean) => {
|
|
118
|
+
let style: CSSProperties = {};
|
|
119
|
+
if (isFocus) {
|
|
120
|
+
switch (border.value) {
|
|
121
|
+
case "surround":
|
|
122
|
+
style = { border: `1px solid ${ColorConfig.primary}` };
|
|
123
|
+
break;
|
|
124
|
+
case "bottom":
|
|
125
|
+
style = { borderBottom: `1px solid ${ColorConfig.primary}` };
|
|
126
|
+
break;
|
|
127
|
+
default:
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return style;
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const onFocus = (e: FocusEvent) => {
|
|
136
|
+
isFocus.value = true;
|
|
137
|
+
emit("focus", e);
|
|
138
|
+
};
|
|
139
|
+
const onBlur = (e: FocusEvent) => {
|
|
140
|
+
isFocus.value = false;
|
|
141
|
+
emit("blur", e);
|
|
142
|
+
// 尝试调用u-form的验证方法
|
|
143
|
+
// formValidate(this, "blur");
|
|
144
|
+
};
|
|
145
|
+
const onLinechange = (e: Event) => {
|
|
146
|
+
emit("linechange", e);
|
|
147
|
+
};
|
|
148
|
+
const onInput = (e: Event) => {
|
|
149
|
+
let { value } = e?.detail;
|
|
150
|
+
// 格式化过滤方法
|
|
151
|
+
const format = formatter.value || innerFormatter;
|
|
152
|
+
const formatValue = format(value);
|
|
153
|
+
// 为了避免props的单向数据流特性,需要先将innerValue值设置为当前值,再在$nextTick中重新赋予设置后的值才有效
|
|
154
|
+
innerValue.value = value;
|
|
155
|
+
nextTick(() => {
|
|
156
|
+
innerValue.value = formatValue;
|
|
157
|
+
valueChange();
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* @description 内容发生变化,进行处理
|
|
162
|
+
* */
|
|
163
|
+
const valueChange = () => {
|
|
164
|
+
const value = innerValue.value;
|
|
165
|
+
nextTick(() => {
|
|
166
|
+
emit("update:modelValue", value);
|
|
167
|
+
// 标识value值的变化是由内部引起的
|
|
168
|
+
changeFromInner.value = true;
|
|
169
|
+
emit("change", value);
|
|
170
|
+
// 尝试调用u-form的验证方法
|
|
171
|
+
// formValidate(this, "change");
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
const onConfirm = (e: Event) => {
|
|
175
|
+
emit("confirm", e);
|
|
176
|
+
};
|
|
177
|
+
const onKeyboardheightchange = (e: Event) => {
|
|
178
|
+
emit("keyboardheightchange", e);
|
|
179
|
+
};
|
|
180
|
+
</script>
|
|
181
|
+
|
|
182
|
+
<style lang="scss" scoped>
|
|
183
|
+
@import "../../libs/css/mixin.scss";
|
|
184
|
+
@import "../../theme.scss";
|
|
185
|
+
|
|
186
|
+
.hy-textarea {
|
|
187
|
+
border-radius: 4px;
|
|
188
|
+
background-color: #fff;
|
|
189
|
+
position: relative;
|
|
190
|
+
@include flex;
|
|
191
|
+
flex: 1;
|
|
192
|
+
padding: 9px;
|
|
193
|
+
|
|
194
|
+
&--radius {
|
|
195
|
+
border-radius: 4px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&--no-radius {
|
|
199
|
+
border-radius: 0;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&--disabled {
|
|
203
|
+
background-color: $hy-color-disable-bg;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
&__field {
|
|
207
|
+
flex: 1;
|
|
208
|
+
font-size: 15px;
|
|
209
|
+
color: #606266ff;
|
|
210
|
+
width: 100%;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
&__count {
|
|
214
|
+
position: absolute;
|
|
215
|
+
right: 5px;
|
|
216
|
+
bottom: 2px;
|
|
217
|
+
font-size: 12px;
|
|
218
|
+
color: $hy-tips-color;
|
|
219
|
+
background-color: #ffffff;
|
|
220
|
+
padding: 1px 4px;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
.hy-border {
|
|
224
|
+
border: $hy-border-line;
|
|
225
|
+
&__bottom {
|
|
226
|
+
border-bottom: $hy-border-line;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import IProps from "./typing";
|
|
2
|
+
const defaultProps: IProps = {
|
|
3
|
+
modelValue: "",
|
|
4
|
+
placeholder: "",
|
|
5
|
+
placeholderClass: "textarea-placeholder",
|
|
6
|
+
height: 70,
|
|
7
|
+
confirmType: "done",
|
|
8
|
+
disabled: false,
|
|
9
|
+
count: false,
|
|
10
|
+
focus: false,
|
|
11
|
+
autoHeight: false,
|
|
12
|
+
fixed: false,
|
|
13
|
+
cursorSpacing: 0,
|
|
14
|
+
cursor: "",
|
|
15
|
+
showConfirmBar: true,
|
|
16
|
+
selectionStart: -1,
|
|
17
|
+
selectionEnd: -1,
|
|
18
|
+
adjustPosition: true,
|
|
19
|
+
disableDefaultPadding: false,
|
|
20
|
+
holdKeyboard: false,
|
|
21
|
+
maxlength: 140,
|
|
22
|
+
border: "surround",
|
|
23
|
+
formatter: null
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default defaultProps;
|