hy-app 0.1.2 → 0.1.4
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 +1 -1
- package/api/http.ts +8 -8
- package/components/dialog/index.ts +2 -2
- package/components/hy-address-picker/hy-address-picker.vue +3 -29
- package/components/hy-address-picker/index.scss +27 -0
- package/components/hy-avatar/hy-avatar.vue +1 -45
- package/components/hy-avatar/index.scss +45 -0
- package/components/hy-avatar/typing.d.ts +1 -1
- package/components/hy-back-top/hy-back-top.vue +7 -22
- package/components/hy-back-top/index.scss +16 -0
- package/components/hy-back-top/props.ts +4 -4
- package/components/hy-back-top/typing.d.ts +2 -3
- package/components/hy-badge/hy-badge.vue +1 -72
- package/components/hy-badge/index.scss +72 -0
- package/components/hy-button/hy-button.vue +17 -128
- package/components/hy-button/index.scss +116 -0
- package/components/hy-button/typing.d.ts +1 -1
- package/components/hy-calendar/header.vue +76 -0
- package/components/hy-calendar/hy-calendar.vue +366 -0
- package/components/hy-calendar/index.scss +171 -0
- package/components/hy-calendar/month.vue +524 -0
- package/components/hy-calendar/props.ts +37 -0
- package/components/hy-calendar/typing.d.ts +126 -0
- package/components/hy-card/hy-card.vue +21 -84
- package/components/hy-card/index.scss +57 -0
- package/components/hy-card/props.ts +2 -2
- package/components/hy-card/typing.d.ts +1 -1
- package/components/hy-cell/hy-cell.vue +1 -137
- package/components/hy-cell/index.scss +137 -0
- package/components/hy-check-button/hy-check-button.vue +1 -0
- package/components/hy-check-button/index.scss +5 -0
- package/components/hy-checkbox/hy-checkbox.vue +2 -95
- package/components/hy-checkbox/index.scss +94 -0
- package/components/hy-checkbox/typing.d.ts +1 -2
- package/components/hy-count-down/hy-count-down.vue +150 -0
- package/components/hy-count-down/index.scss +6 -0
- package/components/hy-count-down/index.ts +52 -0
- package/components/hy-count-down/props.ts +10 -0
- package/components/hy-count-down/typing.d.ts +20 -0
- package/components/hy-count-to/hy-count-to.vue +213 -0
- package/components/hy-count-to/index.scss +6 -0
- package/components/hy-count-to/props.ts +17 -0
- package/components/hy-count-to/typing.d.ts +48 -0
- package/components/hy-datetime-picker/hy-datetime-picker.vue +2 -28
- package/components/hy-datetime-picker/index.scss +28 -0
- package/components/hy-divider/hy-divider.vue +24 -49
- package/components/hy-divider/index.scss +26 -0
- package/components/hy-divider/props.ts +2 -2
- package/components/hy-divider/typing.d.ts +1 -1
- package/components/hy-dropdown/hy-dropdown.vue +43 -0
- package/components/hy-dropdown/index.scss +17 -0
- package/components/hy-dropdown/props.ts +17 -0
- package/components/hy-dropdown/typing.d.ts +48 -0
- package/components/hy-dropdown-item/hy-dropdown-item.vue +194 -0
- package/components/hy-dropdown-item/index.scss +96 -0
- package/components/hy-dropdown-item/props.ts +10 -0
- package/components/hy-dropdown-item/typing.d.ts +31 -0
- package/components/hy-empty/hy-empty.vue +8 -26
- package/components/hy-empty/index.scss +19 -0
- package/components/hy-empty/props.ts +2 -2
- package/components/hy-empty/typing.d.ts +1 -1
- package/components/hy-float-button/hy-float-button.vue +217 -0
- package/components/hy-float-button/index.scss +67 -0
- package/components/hy-float-button/props.ts +25 -0
- package/components/hy-float-button/typing.d.ts +93 -0
- package/components/hy-folding-panel/hy-folding-panel.vue +9 -12
- package/components/hy-folding-panel/index.scss +6 -0
- package/components/hy-folding-panel/props.ts +2 -2
- package/components/hy-folding-panel/typing.d.ts +2 -2
- package/components/hy-form/hy-form.vue +17 -34
- package/components/hy-form/index.scss +30 -0
- package/components/hy-form/props.ts +2 -0
- package/components/hy-form/typing.d.ts +9 -1
- package/components/hy-grid/hy-grid.vue +1 -43
- package/components/hy-grid/index.scss +40 -0
- package/components/hy-icon/hy-icon.vue +1 -93
- package/components/hy-icon/index.scss +84 -0
- package/components/hy-image/hy-image.vue +216 -0
- package/components/hy-image/index.scss +26 -0
- package/components/hy-image/props.ts +24 -0
- package/components/hy-image/typing.d.ts +76 -0
- package/components/hy-input/hy-input.vue +2 -72
- package/components/hy-input/index.scss +65 -0
- package/components/hy-line/hy-line.vue +4 -8
- package/components/hy-line/index.scss +5 -0
- package/components/hy-line/props.ts +3 -3
- package/components/hy-line/typing.d.ts +2 -2
- package/components/hy-line-progress/hy-line-progress.vue +15 -44
- package/components/hy-line-progress/index.scss +38 -0
- package/components/hy-line-progress/props.ts +2 -2
- package/components/hy-line-progress/typing.d.ts +1 -1
- package/components/hy-list/hy-list.vue +11 -41
- package/components/hy-list/index.scss +32 -0
- package/components/hy-list/props.ts +2 -2
- package/components/hy-loading/hy-loading.vue +95 -0
- package/components/hy-loading/index.scss +103 -0
- package/components/hy-loading/props.ts +17 -0
- package/components/hy-loading/typing.d.ts +53 -0
- package/components/hy-login/TheUserLogin.vue +20 -88
- package/components/hy-login/hy-login.vue +9 -9
- package/components/hy-login/props.ts +4 -4
- package/components/hy-modal/hy-modal.vue +11 -89
- package/components/hy-modal/index.scss +77 -0
- package/components/hy-modal/props.ts +2 -2
- package/components/hy-modal/typing.d.ts +1 -1
- package/components/hy-navbar/hy-navbar.vue +20 -92
- package/components/hy-navbar/index.scss +67 -0
- package/components/hy-navbar/props.ts +2 -2
- package/components/hy-navbar/typing.d.ts +1 -1
- package/components/hy-notice-bar/hy-column-notice.vue +11 -39
- package/components/hy-notice-bar/hy-notice-bar.vue +10 -12
- package/components/hy-notice-bar/hy-row-notice.vue +16 -58
- package/components/hy-notice-bar/index.scss +93 -0
- package/components/hy-notice-bar/props.ts +4 -2
- package/components/hy-notice-bar/typing.d.ts +13 -3
- package/components/hy-number-step/hy-number-step.vue +1 -70
- package/components/hy-number-step/index.scss +71 -0
- package/components/hy-overlay/hy-overlay.vue +2 -14
- package/components/hy-overlay/index.scss +9 -0
- package/components/hy-parse/hy-parse.vue +499 -0
- package/components/hy-parse/index.scss +9 -0
- package/components/hy-parse/node/node.vue +584 -0
- package/components/hy-parse/parser.js +1337 -0
- package/components/hy-parse/props.ts +19 -0
- package/components/hy-parse/typing.d.ts +68 -0
- package/components/hy-picker/hy-picker.vue +1 -68
- package/components/hy-picker/index.scss +68 -0
- package/components/hy-popup/hy-popup.vue +1 -74
- package/components/hy-popup/index.scss +60 -0
- package/components/hy-price/hy-price.vue +7 -19
- package/components/hy-price/index.scss +11 -0
- package/components/hy-price/props.ts +4 -3
- package/components/hy-price/typing.d.ts +8 -4
- package/components/hy-qrcode/hy-qrcode.vue +15 -37
- package/components/hy-qrcode/index.scss +23 -0
- package/components/hy-qrcode/props.ts +2 -2
- package/components/hy-qrcode/typing.d.ts +2 -2
- package/components/hy-radio/hy-radio.vue +2 -101
- package/components/hy-radio/index.scss +93 -0
- package/components/hy-radio/typing.d.ts +1 -2
- package/components/hy-rate/hy-rate.vue +1 -33
- package/components/hy-rate/index.scss +33 -0
- package/components/hy-read-more/hy-read-more.vue +7 -30
- package/components/hy-read-more/index.scss +25 -0
- package/components/hy-read-more/props.ts +3 -3
- package/components/hy-read-more/typing.d.ts +1 -1
- package/components/hy-safe-bottom/hy-safe-bottom.vue +5 -9
- package/components/hy-safe-bottom/index.scss +5 -0
- package/components/hy-scroll-list/hy-scroll-list.vue +13 -43
- package/components/hy-scroll-list/index.scss +34 -0
- package/components/hy-scroll-list/props.ts +2 -2
- package/components/hy-scroll-list/typing.d.ts +1 -1
- package/components/hy-search/hy-search.vue +1 -83
- package/components/hy-search/index.scss +83 -0
- package/components/hy-slider/hy-slider.vue +18 -95
- package/components/hy-slider/index.scss +77 -0
- package/components/hy-status-bar/hy-status-bar.vue +41 -0
- package/components/hy-status-bar/index.scss +6 -0
- package/components/hy-status-bar/props.ts +8 -0
- package/components/hy-status-bar/typing.d.ts +12 -0
- package/components/hy-steps/hy-steps.vue +36 -163
- package/components/hy-steps/index.scss +131 -0
- package/components/hy-steps/props.ts +2 -2
- package/components/hy-steps/typing.d.ts +2 -2
- package/components/hy-submitBar/Index.vue +17 -0
- package/components/hy-submitBar/hy-submitBar.vue +216 -0
- package/components/hy-submitBar/index.scss +9 -0
- package/components/hy-submitBar/props.ts +22 -0
- package/components/hy-submitBar/typing.d.ts +88 -0
- package/components/hy-subsection/hy-subsection.vue +40 -132
- package/components/hy-subsection/index.scss +82 -0
- package/components/hy-subsection/props.ts +1 -0
- package/components/hy-subsection/typing.d.ts +13 -4
- package/components/hy-swipe-action/hy-swipe-action.vue +294 -0
- package/components/hy-swipe-action/index.scss +9 -0
- package/components/hy-swipe-action/index.wxs +235 -0
- package/components/hy-swipe-action/props.ts +16 -0
- package/components/hy-swipe-action/typing.d.ts +55 -0
- package/components/hy-swipe-action/wxs.js +15 -0
- package/components/hy-swiper/hy-swiper-indicator.vue +5 -35
- package/components/hy-swiper/hy-swiper.vue +1 -54
- package/components/hy-swiper/index.scss +82 -0
- package/components/hy-switch/hy-switch.vue +62 -72
- package/components/hy-switch/index.scss +46 -0
- package/components/hy-switch/props.ts +4 -1
- package/components/hy-switch/typing.d.ts +14 -1
- package/components/hy-tabs/hy-tabs.vue +22 -81
- package/components/hy-tabs/index.scss +63 -0
- package/components/hy-tabs/props.ts +5 -5
- package/components/hy-tabs/typing.d.ts +1 -1
- package/components/hy-tag/hy-tag.vue +25 -220
- package/components/hy-tag/index.scss +205 -0
- package/components/hy-text/hy-text.vue +238 -0
- package/components/hy-text/index.scss +70 -0
- package/components/hy-text/index.ts +0 -0
- package/components/hy-text/props.ts +30 -0
- package/components/hy-text/typing.d.ts +98 -0
- package/components/hy-textarea/hy-textarea.vue +1 -46
- package/components/hy-textarea/index.scss +40 -0
- package/components/hy-toast/hy-toast.vue +175 -0
- package/components/hy-toast/index.scss +77 -0
- package/components/hy-toast/props.ts +3 -0
- package/components/hy-toast/typing.d.ts +38 -0
- package/components/hy-tooltip/hy-tooltip.vue +42 -95
- package/components/hy-tooltip/index.scss +64 -0
- package/components/hy-tooltip/props.ts +2 -2
- package/components/hy-tooltip/typing.d.ts +1 -1
- package/components/hy-transition/hy-transition.vue +4 -2
- package/components/hy-transition/typing.d.ts +1 -13
- package/components/hy-upload/hy-upload.vue +37 -182
- package/components/hy-upload/index.scss +147 -0
- package/components/hy-upload/props.ts +2 -2
- package/components/hy-upload/typing.d.ts +11 -11
- package/components/hy-warn/hy-warn.vue +17 -144
- package/components/hy-warn/index.scss +109 -0
- package/components/hy-warn/props.ts +3 -3
- package/components/hy-warn/typing.d.ts +4 -3
- package/components/hy-waterfall/hy-waterfall.vue +168 -38
- package/components/hy-waterfall/index.scss +16 -0
- package/components/hy-waterfall/props.ts +4 -5
- package/components/hy-waterfall/typing.d.ts +5 -9
- package/components/index.ts +25 -1
- package/components/message/index.ts +54 -54
- package/composables/index.ts +1 -0
- package/composables/useShare.ts +27 -0
- package/config/color.ts +3 -2
- package/config/icon.ts +21 -1
- package/global/index.ts +6 -6
- package/global/register-properties.ts +2 -2
- package/index.scss +2 -1
- package/index.ts +9 -8
- package/libs/css/common.scss +14 -2
- package/package.json +3 -2
- package/{libs/css → public/font}/iconfont.css +4 -4
- package/theme.scss +6 -4
- package/typing/index.ts +1 -1
- package/typing/modules/common.d.ts +36 -1
- package/utils/calendar.js +1021 -0
- package/utils/colorGradient.ts +112 -0
- package/utils/index.ts +2 -0
- package/utils/inside.ts +80 -34
- package/utils/inspect.ts +115 -0
- package/utils/utils.ts +20 -19
- package/libs/css/download.zip +0 -0
- /package/{libs/css → public/font}/iconfont.ttf +0 -0
- /package/{libs/css → public/font}/iconfont.woff +0 -0
- /package/{libs/css → public/font}/iconfont.woff2 +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@use "../../theme.scss" as *;
|
|
2
|
+
|
|
3
|
+
.hy-form {
|
|
4
|
+
&--item {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: v-bind(labelPos);
|
|
7
|
+
//align-items: center;
|
|
8
|
+
margin-bottom: $hy-border-margin-padding-lg;
|
|
9
|
+
&__label {
|
|
10
|
+
padding: $hy-border-margin-padding-base 0;
|
|
11
|
+
}
|
|
12
|
+
&__container {
|
|
13
|
+
flex: 1;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
&-content {
|
|
17
|
+
flex: 1;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
.flex {
|
|
21
|
+
flex: 1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
&-warning {
|
|
25
|
+
color: $hy-error;
|
|
26
|
+
font-size: $hy-font-size-hint;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -23,7 +23,15 @@ export default interface IProps {
|
|
|
23
23
|
* center - 中间对齐
|
|
24
24
|
* right - 右对齐
|
|
25
25
|
* */
|
|
26
|
-
labelAlign?: HyApp.
|
|
26
|
+
labelAlign?: HyApp.RowCenterType;
|
|
27
|
+
/**
|
|
28
|
+
* @description 显示冒号符号
|
|
29
|
+
* */
|
|
30
|
+
symbol?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @description 显示底部下划线
|
|
33
|
+
* */
|
|
34
|
+
borderBottom?: boolean;
|
|
27
35
|
/**
|
|
28
36
|
* @description 当行内容高度
|
|
29
37
|
* */
|
|
@@ -77,51 +77,9 @@ const childClick = (name: string | Record<string, any>) => {
|
|
|
77
77
|
</script>
|
|
78
78
|
|
|
79
79
|
<style lang="scss" scoped>
|
|
80
|
-
@import "../../libs/css/mixin.scss";
|
|
81
|
-
@import "../../theme.scss";
|
|
82
80
|
.hy-grid {
|
|
83
|
-
/* #ifdef APP-NVUE */
|
|
84
|
-
position: relative;
|
|
85
|
-
box-sizing: border-box;
|
|
86
|
-
overflow: hidden;
|
|
87
|
-
display: block;
|
|
88
|
-
/* #endif */
|
|
89
|
-
justify-content: center;
|
|
90
|
-
@include flex;
|
|
91
|
-
flex-wrap: wrap;
|
|
92
|
-
align-items: center;
|
|
93
|
-
// 在uni-app中应尽量避免使用flex布局以外的方式,因为nvue/uvue等方案都支持flex布局
|
|
94
|
-
// 这里使用grid布局使用为目前20240409uni-app在抖音小程序开启virtualHost时有bug,存在事件失效问题。
|
|
95
|
-
/* #ifndef APP-NVUE */
|
|
96
|
-
display: grid;
|
|
97
81
|
grid-gap: v-bind(gap);
|
|
98
82
|
grid-template-columns: repeat(v-bind(col), 1fr);
|
|
99
|
-
/* #endif */
|
|
100
|
-
&-item {
|
|
101
|
-
align-items: center;
|
|
102
|
-
justify-content: center;
|
|
103
|
-
position: relative;
|
|
104
|
-
flex-direction: column;
|
|
105
|
-
overflow: hidden;
|
|
106
|
-
/* #ifndef APP-NVUE */
|
|
107
|
-
box-sizing: border-box;
|
|
108
|
-
display: flex;
|
|
109
|
-
/* #endif */
|
|
110
|
-
|
|
111
|
-
/* #ifdef MP */
|
|
112
|
-
position: relative;
|
|
113
|
-
float: left;
|
|
114
|
-
/* #endif */
|
|
115
|
-
|
|
116
|
-
&--hover-class {
|
|
117
|
-
opacity: 0.7;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
&__title {
|
|
121
|
-
color: #000;
|
|
122
|
-
line-height: 60rpx;
|
|
123
|
-
font-size: $hy-font-size-sm;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
83
|
}
|
|
84
|
+
@import "./index.scss";
|
|
127
85
|
</style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
@use "../../libs/css/mixin.scss" as *;
|
|
2
|
+
@use "../../theme.scss" as *;
|
|
3
|
+
|
|
4
|
+
.hy-grid {
|
|
5
|
+
justify-content: center;
|
|
6
|
+
@include flex;
|
|
7
|
+
flex-wrap: wrap;
|
|
8
|
+
align-items: center;
|
|
9
|
+
// 在uni-app中应尽量避免使用flex布局以外的方式,因为nvue/uvue等方案都支持flex布局
|
|
10
|
+
// 这里使用grid布局使用为目前20240409uni-app在抖音小程序开启virtualHost时有bug,存在事件失效问题。
|
|
11
|
+
/* #ifndef APP-NVUE */
|
|
12
|
+
display: grid;
|
|
13
|
+
/* #endif */
|
|
14
|
+
&-item {
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
position: relative;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
/* #ifndef APP-NVUE */
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
display: flex;
|
|
23
|
+
/* #endif */
|
|
24
|
+
|
|
25
|
+
/* #ifdef MP */
|
|
26
|
+
position: relative;
|
|
27
|
+
float: left;
|
|
28
|
+
/* #endif */
|
|
29
|
+
|
|
30
|
+
&--hover-class {
|
|
31
|
+
opacity: 0.7;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&__title {
|
|
35
|
+
color: #000;
|
|
36
|
+
line-height: 60rpx;
|
|
37
|
+
font-size: $hy-font-size-sm;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -113,97 +113,5 @@ const clickHandler = (e: any) => {
|
|
|
113
113
|
</script>
|
|
114
114
|
|
|
115
115
|
<style lang="scss" scoped>
|
|
116
|
-
@import "
|
|
117
|
-
@import "../../libs/css/iconfont.css";
|
|
118
|
-
@import "../../theme.scss";
|
|
119
|
-
|
|
120
|
-
/* #ifndef APP-NVUE */
|
|
121
|
-
// 非nvue下加载字体
|
|
122
|
-
@font-face {
|
|
123
|
-
font-family: "uicon-iconfont";
|
|
124
|
-
src: url("https://at.alicdn.com/t/font_2225171_8kdcwk4po24.ttf")
|
|
125
|
-
format("truetype");
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/* #endif */
|
|
129
|
-
|
|
130
|
-
.hy-icon {
|
|
131
|
-
/* #ifndef APP-NVUE */
|
|
132
|
-
display: flex;
|
|
133
|
-
/* #endif */
|
|
134
|
-
align-items: center;
|
|
135
|
-
|
|
136
|
-
&--left {
|
|
137
|
-
flex-direction: row-reverse;
|
|
138
|
-
align-items: center;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
&--right {
|
|
142
|
-
flex-direction: row;
|
|
143
|
-
align-items: center;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
&--top {
|
|
147
|
-
flex-direction: column-reverse;
|
|
148
|
-
justify-content: center;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
&--bottom {
|
|
152
|
-
flex-direction: column;
|
|
153
|
-
justify-content: center;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
&__icon {
|
|
157
|
-
position: relative;
|
|
158
|
-
@include flex;
|
|
159
|
-
align-items: center;
|
|
160
|
-
|
|
161
|
-
&--primary {
|
|
162
|
-
color: $hy-primary;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
&--success {
|
|
166
|
-
color: $hy-success;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
&--error {
|
|
170
|
-
color: $hy-error;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
&--warning {
|
|
174
|
-
color: $hy-warning;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
&--info {
|
|
178
|
-
color: $hy-info;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
&__img {
|
|
183
|
-
/* #ifndef APP-NVUE */
|
|
184
|
-
height: auto;
|
|
185
|
-
will-change: transform;
|
|
186
|
-
/* #endif */
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
&__label {
|
|
190
|
-
@include line-feed();
|
|
191
|
-
overflow: hidden;
|
|
192
|
-
/* #ifndef APP-NVUE */
|
|
193
|
-
line-height: 1;
|
|
194
|
-
/* #endif */
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
.hy-rotate {
|
|
198
|
-
animation: hy-rotate 1s infinite linear;
|
|
199
|
-
@keyframes hy-rotate {
|
|
200
|
-
0% {
|
|
201
|
-
transform: rotate(0deg);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
to {
|
|
205
|
-
transform: rotate(1turn);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
116
|
+
@import "./index.scss";
|
|
209
117
|
</style>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
@use "../../libs/css/mixin.scss" as *;
|
|
2
|
+
@use "../../public/font/iconfont.css" as *;
|
|
3
|
+
@use "../../theme.scss" as *;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
.hy-icon {
|
|
7
|
+
/* #ifndef APP-NVUE */
|
|
8
|
+
display: flex;
|
|
9
|
+
/* #endif */
|
|
10
|
+
align-items: center;
|
|
11
|
+
|
|
12
|
+
&--left {
|
|
13
|
+
flex-direction: row-reverse;
|
|
14
|
+
align-items: center;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&--right {
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
align-items: center;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&--top {
|
|
23
|
+
flex-direction: column-reverse;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&--bottom {
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__icon {
|
|
33
|
+
position: relative;
|
|
34
|
+
@include flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
|
|
37
|
+
&--primary {
|
|
38
|
+
color: $hy-primary;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&--success {
|
|
42
|
+
color: $hy-success;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&--error {
|
|
46
|
+
color: $hy-error;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&--warning {
|
|
50
|
+
color: $hy-warning;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&--info {
|
|
54
|
+
color: $hy-info;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&__img {
|
|
59
|
+
/* #ifndef APP-NVUE */
|
|
60
|
+
height: auto;
|
|
61
|
+
will-change: transform;
|
|
62
|
+
/* #endif */
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&__label {
|
|
66
|
+
@include line-feed();
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
/* #ifndef APP-NVUE */
|
|
69
|
+
line-height: 1;
|
|
70
|
+
/* #endif */
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
.hy-rotate {
|
|
74
|
+
animation: hy-rotate 1s infinite linear;
|
|
75
|
+
@keyframes hy-rotate {
|
|
76
|
+
0% {
|
|
77
|
+
transform: rotate(0deg);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
to {
|
|
81
|
+
transform: rotate(1turn);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<HyTransition
|
|
3
|
+
mode="fade"
|
|
4
|
+
:show="show"
|
|
5
|
+
:style="transStyle"
|
|
6
|
+
:duration="fade ? 1000 : 0"
|
|
7
|
+
>
|
|
8
|
+
<view
|
|
9
|
+
class="hy-image box-border"
|
|
10
|
+
@tap="clickHandler"
|
|
11
|
+
:style="[wrapStyle, backgroundStyle]"
|
|
12
|
+
>
|
|
13
|
+
<image
|
|
14
|
+
v-if="!isError"
|
|
15
|
+
:src="src"
|
|
16
|
+
:mode="mode"
|
|
17
|
+
@error="onErrorHandler"
|
|
18
|
+
@load="onLoadHandler"
|
|
19
|
+
:show-menu-by-longpress="showMenuByLongPress"
|
|
20
|
+
:lazy-load="lazyLoad"
|
|
21
|
+
class="hy-image__image"
|
|
22
|
+
:style="{
|
|
23
|
+
width: addUnit(width),
|
|
24
|
+
height: addUnit(height),
|
|
25
|
+
borderRadius: shape == 'circle' ? '10000px' : addUnit(radius),
|
|
26
|
+
}"
|
|
27
|
+
></image>
|
|
28
|
+
<view
|
|
29
|
+
v-if="showLoading && loading"
|
|
30
|
+
class="hy-image__loading"
|
|
31
|
+
:style="{
|
|
32
|
+
borderRadius: shape == 'circle' ? '50%' : addUnit(radius),
|
|
33
|
+
backgroundColor: bgColor,
|
|
34
|
+
width: addUnit(width),
|
|
35
|
+
height: addUnit(height),
|
|
36
|
+
}"
|
|
37
|
+
>
|
|
38
|
+
<slot name="loading">
|
|
39
|
+
<HyIcon :name="loadingIcon"></HyIcon>
|
|
40
|
+
</slot>
|
|
41
|
+
</view>
|
|
42
|
+
<view
|
|
43
|
+
v-if="showError && isError && !loading"
|
|
44
|
+
class="hy-image__error"
|
|
45
|
+
:style="{
|
|
46
|
+
borderRadius: shape == 'circle' ? '50%' : addUnit(radius),
|
|
47
|
+
}"
|
|
48
|
+
>
|
|
49
|
+
<slot name="error">
|
|
50
|
+
<HyIcon :name="errorIcon"></HyIcon>
|
|
51
|
+
</slot>
|
|
52
|
+
</view>
|
|
53
|
+
</view>
|
|
54
|
+
</HyTransition>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script setup lang="ts">
|
|
58
|
+
import {
|
|
59
|
+
computed,
|
|
60
|
+
type CSSProperties,
|
|
61
|
+
onMounted,
|
|
62
|
+
ref,
|
|
63
|
+
toRefs,
|
|
64
|
+
watch,
|
|
65
|
+
} from "vue";
|
|
66
|
+
import defaultProps from "./props";
|
|
67
|
+
import type IProps from "./typing";
|
|
68
|
+
import { addUnit, getPx } from "../../utils";
|
|
69
|
+
|
|
70
|
+
// 组件
|
|
71
|
+
|
|
72
|
+
import HyTransition from "../hy-transition/hy-transition.vue";
|
|
73
|
+
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
74
|
+
|
|
75
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
76
|
+
const {
|
|
77
|
+
customStyle,
|
|
78
|
+
duration,
|
|
79
|
+
src,
|
|
80
|
+
width,
|
|
81
|
+
height,
|
|
82
|
+
mode,
|
|
83
|
+
shape,
|
|
84
|
+
radius,
|
|
85
|
+
bgColor,
|
|
86
|
+
previewImage,
|
|
87
|
+
} = toRefs(props);
|
|
88
|
+
const emit = defineEmits(["click", "error", "load"]);
|
|
89
|
+
|
|
90
|
+
// 图片是否加载错误,如果是,则显示错误占位图
|
|
91
|
+
const isError = ref(false);
|
|
92
|
+
// 初始化组件时,默认为加载中状态
|
|
93
|
+
const loading = ref(true);
|
|
94
|
+
// 不透明度,为了实现淡入淡出的效果
|
|
95
|
+
const opacity = ref(1);
|
|
96
|
+
// 过渡时间,因为props的值无法修改,故需要一个中间值
|
|
97
|
+
const durationTime = ref(duration.value);
|
|
98
|
+
// 图片加载完成时,去掉背景颜色,因为如果是png图片,就会显示灰色的背景
|
|
99
|
+
const backgroundStyle = ref({});
|
|
100
|
+
// 用于fade模式的控制组件显示与否
|
|
101
|
+
const show = ref(false);
|
|
102
|
+
|
|
103
|
+
watch(
|
|
104
|
+
() => src.value,
|
|
105
|
+
(newValue) => {
|
|
106
|
+
if (!newValue) {
|
|
107
|
+
// 如果传入null或者'',或者false,或者undefined,标记为错误状态
|
|
108
|
+
isError.value = true;
|
|
109
|
+
} else {
|
|
110
|
+
isError.value = false;
|
|
111
|
+
loading.value = true;
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
{ immediate: true },
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const transStyle = computed<CSSProperties>(() => {
|
|
118
|
+
const style: CSSProperties = {};
|
|
119
|
+
if (
|
|
120
|
+
loading.value ||
|
|
121
|
+
isError.value ||
|
|
122
|
+
width.value == "100%" ||
|
|
123
|
+
mode.value != "heightFix"
|
|
124
|
+
) {
|
|
125
|
+
style.width = addUnit(width.value);
|
|
126
|
+
} else {
|
|
127
|
+
style.width = "fit-content";
|
|
128
|
+
}
|
|
129
|
+
if (
|
|
130
|
+
loading.value ||
|
|
131
|
+
isError.value ||
|
|
132
|
+
height.value == "100%" ||
|
|
133
|
+
mode.value != "widthFix"
|
|
134
|
+
) {
|
|
135
|
+
style.height = addUnit(height.value);
|
|
136
|
+
} else {
|
|
137
|
+
style.height = "fit-content";
|
|
138
|
+
}
|
|
139
|
+
return style;
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const wrapStyle = computed(() => {
|
|
143
|
+
const style: CSSProperties = {};
|
|
144
|
+
if (
|
|
145
|
+
loading.value ||
|
|
146
|
+
isError.value ||
|
|
147
|
+
width.value == "100%" ||
|
|
148
|
+
mode.value != "heightFix"
|
|
149
|
+
) {
|
|
150
|
+
style.width = addUnit(width.value);
|
|
151
|
+
} else {
|
|
152
|
+
style.width = "fit-content";
|
|
153
|
+
}
|
|
154
|
+
if (
|
|
155
|
+
loading.value ||
|
|
156
|
+
isError.value ||
|
|
157
|
+
height.value == "100%" ||
|
|
158
|
+
mode.value != "widthFix"
|
|
159
|
+
) {
|
|
160
|
+
style.height = addUnit(height.value);
|
|
161
|
+
} else {
|
|
162
|
+
style.height = "fit-content";
|
|
163
|
+
}
|
|
164
|
+
// 如果是显示圆形,设置一个很多的半径值即可
|
|
165
|
+
style.borderRadius =
|
|
166
|
+
shape.value == "circle" ? "10000px" : addUnit(radius.value);
|
|
167
|
+
// 如果设置圆角,必须要有hidden,否则可能圆角无效
|
|
168
|
+
style.overflow = getPx(radius.value) > 0 ? "hidden" : "visible";
|
|
169
|
+
|
|
170
|
+
return Object.assign(style, customStyle.value);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
onMounted(() => {
|
|
174
|
+
show.value = true;
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const clickHandler = () => {
|
|
178
|
+
emit("click");
|
|
179
|
+
|
|
180
|
+
if (previewImage.value) {
|
|
181
|
+
uni.previewImage({
|
|
182
|
+
urls: [src.value],
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @description 图片加载失败
|
|
189
|
+
* */
|
|
190
|
+
const onErrorHandler = (err: Event) => {
|
|
191
|
+
loading.value = false;
|
|
192
|
+
isError.value = true;
|
|
193
|
+
emit("error", err);
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @description 图片加载成功
|
|
198
|
+
* */
|
|
199
|
+
const onLoadHandler = (e: Event) => {
|
|
200
|
+
loading.value = false;
|
|
201
|
+
isError.value = false;
|
|
202
|
+
emit("load", e);
|
|
203
|
+
removeBgColor();
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const removeBgColor = () => {
|
|
207
|
+
// 淡入动画过渡完成后,将背景设置为透明色,否则png图片会看到灰色的背景
|
|
208
|
+
backgroundStyle.value = {
|
|
209
|
+
backgroundColor: bgColor.value || "#ffffff",
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
</script>
|
|
213
|
+
|
|
214
|
+
<style scoped lang="scss">
|
|
215
|
+
@import "./index.scss";
|
|
216
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@use "../../libs/css/mixin.scss" as *;
|
|
2
|
+
|
|
3
|
+
.hy-image {
|
|
4
|
+
position: relative;
|
|
5
|
+
transition: opacity 0.5s ease-in-out;
|
|
6
|
+
|
|
7
|
+
&__image {
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&__loading,
|
|
13
|
+
&__error {
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: 0;
|
|
16
|
+
left: 0;
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
@include flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
background-color: #f8f8f8ff;
|
|
23
|
+
color: #909193ff;
|
|
24
|
+
font-size: 46px;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type IProps from "./typing";
|
|
2
|
+
import { IconConfig } from "../../config";
|
|
3
|
+
|
|
4
|
+
const defaultProps: IProps = {
|
|
5
|
+
src: "",
|
|
6
|
+
mode: "aspectFill",
|
|
7
|
+
width: "200",
|
|
8
|
+
height: "150",
|
|
9
|
+
shape: "square",
|
|
10
|
+
radius: 0,
|
|
11
|
+
lazyLoad: true,
|
|
12
|
+
showMenuByLongPress: true,
|
|
13
|
+
loadingIcon: IconConfig.LOADING,
|
|
14
|
+
errorIcon: IconConfig.NOTICE,
|
|
15
|
+
showLoading: true,
|
|
16
|
+
showError: true,
|
|
17
|
+
fade: true,
|
|
18
|
+
webp: false,
|
|
19
|
+
duration: 500,
|
|
20
|
+
bgColor: "#f3f4f6",
|
|
21
|
+
previewImage: false,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default defaultProps;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { CSSProperties } from "vue";
|
|
2
|
+
|
|
3
|
+
export default interface IProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description 图片地址
|
|
6
|
+
* */
|
|
7
|
+
src?: string;
|
|
8
|
+
/**
|
|
9
|
+
* @description 裁剪模式,见官网说明 (默认 'aspectFill' )
|
|
10
|
+
* */
|
|
11
|
+
mode?: HyApp.ImageModeVo;
|
|
12
|
+
/**
|
|
13
|
+
* @description 宽度,单位任意,如果为数值,则为px单位 (默认 '300' )
|
|
14
|
+
* */
|
|
15
|
+
width?: string | number;
|
|
16
|
+
/**
|
|
17
|
+
* @description 高度,单位任意,如果为数值,则为px单位 (默认 '225' )
|
|
18
|
+
* */
|
|
19
|
+
height?: string | number;
|
|
20
|
+
/**
|
|
21
|
+
* @description 图片形状,circle-圆形,square-方形 (默认 'square' )
|
|
22
|
+
* */
|
|
23
|
+
shape?: HyApp.ShapeType;
|
|
24
|
+
/**
|
|
25
|
+
* @description 圆角值,单位任意,如果为数值,则为px单位 (默认 0 )
|
|
26
|
+
* */
|
|
27
|
+
radius?: number | string;
|
|
28
|
+
/**
|
|
29
|
+
* @description 是否懒加载,仅微信小程序、App、百度小程序、字节跳动小程序有效 (默认 true )
|
|
30
|
+
* */
|
|
31
|
+
lazyLoad?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @description 是否开启长按图片显示识别小程序码菜单,仅微信小程序有效 (默认 true )
|
|
34
|
+
* */
|
|
35
|
+
showMenuByLongPress?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* @description 加载中的图标,或者小图片 (默认 'photo' )
|
|
38
|
+
* */
|
|
39
|
+
loadingIcon?: string;
|
|
40
|
+
/**
|
|
41
|
+
* @description 加载失败的图标,或者小图片 (默认 'error-circle' )
|
|
42
|
+
* */
|
|
43
|
+
errorIcon?: string;
|
|
44
|
+
/**
|
|
45
|
+
* @description 是否显示加载中的图标或者自定义的slot (默认 true )
|
|
46
|
+
* */
|
|
47
|
+
showLoading?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* @description 是否显示加载错误的图标或者自定义的slot (默认 true )
|
|
50
|
+
* */
|
|
51
|
+
showError?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* @description 是否需要淡入效果 (默认 true )
|
|
54
|
+
* */
|
|
55
|
+
fade?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* @description 只支持网络资源,只对微信小程序有效 (默认 false )
|
|
58
|
+
* */
|
|
59
|
+
webp?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* @description 搭配fade参数的过渡时间,单位ms (默认 500 )
|
|
62
|
+
* */
|
|
63
|
+
duration?: number;
|
|
64
|
+
/**
|
|
65
|
+
* @description 背景颜色,用于深色页面加载图片时,为了和背景色融合 (默认 '#f3f4f6' )
|
|
66
|
+
* */
|
|
67
|
+
bgColor?: string;
|
|
68
|
+
/**
|
|
69
|
+
* @description 是否预览图片 (默认 false )
|
|
70
|
+
* */
|
|
71
|
+
previewImage?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* @description 定义需要用到的外部样式
|
|
74
|
+
* */
|
|
75
|
+
customStyle?: CSSProperties;
|
|
76
|
+
}
|