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,198 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="hy-card" @tap.stop="click" :class="cardClass" :style="cardStyle">
|
|
3
|
+
<view
|
|
4
|
+
v-if="showHead"
|
|
5
|
+
class="hy-card__head"
|
|
6
|
+
:style="[{ padding: addUnit(paddingHead || padding) }, headStyle]"
|
|
7
|
+
:class="{
|
|
8
|
+
'hy-border-bottom': headBorderBottom
|
|
9
|
+
}"
|
|
10
|
+
@tap="headClick"
|
|
11
|
+
>
|
|
12
|
+
<view v-if="!$slots.header" class="hy-card__head--flex">
|
|
13
|
+
<view class="hy-card__head--left" v-if="title">
|
|
14
|
+
<image
|
|
15
|
+
:src="thumb"
|
|
16
|
+
class="hy-card__head--left__thumb"
|
|
17
|
+
mode="aspectFill"
|
|
18
|
+
v-if="thumb"
|
|
19
|
+
:style="{
|
|
20
|
+
height: addUnit(thumbWidth),
|
|
21
|
+
width: addUnit(thumbWidth),
|
|
22
|
+
borderRadius: thumbCircle ? '50px' : '4px'
|
|
23
|
+
}"
|
|
24
|
+
></image>
|
|
25
|
+
<text
|
|
26
|
+
class="hy-card__head--left__title"
|
|
27
|
+
:style="{
|
|
28
|
+
fontSize: addUnit(titleSize),
|
|
29
|
+
color: titleColor
|
|
30
|
+
}"
|
|
31
|
+
>
|
|
32
|
+
{{ title }}
|
|
33
|
+
</text>
|
|
34
|
+
</view>
|
|
35
|
+
<view class="hy-card__head--right hy-line-1" v-if="subTitle">
|
|
36
|
+
<text
|
|
37
|
+
class="hy-card__head__title__text"
|
|
38
|
+
:style="{
|
|
39
|
+
fontSize: addUnit(subTitleSize),
|
|
40
|
+
color: subTitleColor
|
|
41
|
+
}"
|
|
42
|
+
>
|
|
43
|
+
{{ subTitle }}
|
|
44
|
+
</text>
|
|
45
|
+
</view>
|
|
46
|
+
</view>
|
|
47
|
+
<slot name="header" v-else />
|
|
48
|
+
</view>
|
|
49
|
+
<view
|
|
50
|
+
@tap="bodyClick"
|
|
51
|
+
class="hy-card__body"
|
|
52
|
+
:style="[{ padding: addUnit(paddingBody || padding) }, bodyStyle]"
|
|
53
|
+
>
|
|
54
|
+
<slot name="body" />
|
|
55
|
+
</view>
|
|
56
|
+
<view
|
|
57
|
+
v-if="showFoot"
|
|
58
|
+
class="hy-card__foot"
|
|
59
|
+
@tap="footClick"
|
|
60
|
+
:style="[
|
|
61
|
+
{ padding: $slots.foot ? addUnit(paddingFoot || padding) : 0 },
|
|
62
|
+
footStyle
|
|
63
|
+
]"
|
|
64
|
+
:class="{
|
|
65
|
+
'hy-border-top': footBorderTop
|
|
66
|
+
}"
|
|
67
|
+
>
|
|
68
|
+
<slot name="footer" />
|
|
69
|
+
</view>
|
|
70
|
+
</view>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<script setup lang="ts">
|
|
74
|
+
import defaultProps from "./props";
|
|
75
|
+
import IProps from "./typing";
|
|
76
|
+
import { addUnit } from "../../utils";
|
|
77
|
+
import { computed, toRefs } from "vue";
|
|
78
|
+
|
|
79
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
80
|
+
const { border, full, borderRadius, margin, boxShadow, customStyle } =
|
|
81
|
+
toRefs(props);
|
|
82
|
+
const emit = defineEmits(["click", "head-click", "body-click", "foot-click"]);
|
|
83
|
+
|
|
84
|
+
const cardClass = computed(() => {
|
|
85
|
+
return [
|
|
86
|
+
border.value && "hy-border",
|
|
87
|
+
full.value && "hy-border",
|
|
88
|
+
border.value && "hy-card-full",
|
|
89
|
+
(typeof borderRadius.value === "number"
|
|
90
|
+
? borderRadius.value
|
|
91
|
+
: parseInt(borderRadius.value.replace(/px|rpx|vw|vh/g, "")) > 0) &&
|
|
92
|
+
"hy-card--border"
|
|
93
|
+
].filter(Boolean);
|
|
94
|
+
});
|
|
95
|
+
const cardStyle = computed(() => {
|
|
96
|
+
return Object.assign(customStyle.value, {
|
|
97
|
+
borderRadius: addUnit(borderRadius.value),
|
|
98
|
+
margin: margin.value,
|
|
99
|
+
boxShadow: boxShadow.value
|
|
100
|
+
? typeof boxShadow.value === "boolean"
|
|
101
|
+
? "0 0 10rpx 4rpx rgba(0, 0, 0, 0.16)"
|
|
102
|
+
: boxShadow.value
|
|
103
|
+
: ""
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const click = () => {
|
|
108
|
+
emit("click", props.index);
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* @description 点击头部
|
|
112
|
+
* */
|
|
113
|
+
const headClick = () => {
|
|
114
|
+
emit("head-click", props.index);
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* @description 点击身体
|
|
118
|
+
* */
|
|
119
|
+
const bodyClick = () => {
|
|
120
|
+
emit("body-click", props.index);
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* @description 点击尾部
|
|
124
|
+
* */
|
|
125
|
+
const footClick = () => {
|
|
126
|
+
emit("foot-click", props.index);
|
|
127
|
+
};
|
|
128
|
+
</script>
|
|
129
|
+
|
|
130
|
+
<style lang="scss" scoped>
|
|
131
|
+
@import "../../libs/css/mixin.scss";
|
|
132
|
+
@import "../../theme.scss";
|
|
133
|
+
|
|
134
|
+
.hy-card {
|
|
135
|
+
position: relative;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
font-size: 28rpx;
|
|
138
|
+
background-color: #ffffff;
|
|
139
|
+
box-sizing: border-box;
|
|
140
|
+
|
|
141
|
+
&-full {
|
|
142
|
+
// 如果是与屏幕之间不留空隙,应该设置左右边距为0
|
|
143
|
+
margin-left: 0 !important;
|
|
144
|
+
margin-right: 0 !important;
|
|
145
|
+
width: 100%;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&--border:after {
|
|
149
|
+
border-radius: 16rpx;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&__head {
|
|
153
|
+
&--flex {
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
justify-content: space-between;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&--left {
|
|
160
|
+
color: #303133ff;
|
|
161
|
+
display: flex;
|
|
162
|
+
|
|
163
|
+
&__thumb {
|
|
164
|
+
margin-right: 16rpx;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&__title {
|
|
168
|
+
max-width: 400rpx;
|
|
169
|
+
height: 20px;
|
|
170
|
+
@include line-feed;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&--right {
|
|
175
|
+
color: $hy-text-color-grey;
|
|
176
|
+
margin-left: 6rpx;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&__body {
|
|
181
|
+
color: $hy-bg-color;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
&__foot {
|
|
185
|
+
color: $hy-text-color-grey;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
.hy-border-bottom {
|
|
189
|
+
border-bottom: $hy-border-line;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.hy-border-top {
|
|
193
|
+
border-top: $hy-border-line;
|
|
194
|
+
}
|
|
195
|
+
.hy-border {
|
|
196
|
+
border: $hy-border-line;
|
|
197
|
+
}
|
|
198
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import IProps from "./typing";
|
|
2
|
+
|
|
3
|
+
const defaultProps: IProps = {
|
|
4
|
+
full: false,
|
|
5
|
+
title: "",
|
|
6
|
+
titleColor: "#303133",
|
|
7
|
+
titleSize: "15px",
|
|
8
|
+
subTitle: "",
|
|
9
|
+
subTitleColor: "#909399",
|
|
10
|
+
subTitleSize: "13",
|
|
11
|
+
border: true,
|
|
12
|
+
index: "",
|
|
13
|
+
margin: "15px",
|
|
14
|
+
borderRadius: "8px",
|
|
15
|
+
headBorderBottom: true,
|
|
16
|
+
footBorderTop: true,
|
|
17
|
+
thumb: "",
|
|
18
|
+
thumbWidth: "30px",
|
|
19
|
+
thumbCircle: false,
|
|
20
|
+
padding: "15px",
|
|
21
|
+
paddingHead: "",
|
|
22
|
+
paddingBody: "",
|
|
23
|
+
paddingFoot: "",
|
|
24
|
+
showHead: true,
|
|
25
|
+
showFoot: true,
|
|
26
|
+
boxShadow: true
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default defaultProps;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { CSSProperties } from "vue";
|
|
2
|
+
|
|
3
|
+
export default interface IProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description 卡片与屏幕两侧是否留空隙(默认false)
|
|
6
|
+
* */
|
|
7
|
+
full?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* @description 头部左边的标题
|
|
10
|
+
* */
|
|
11
|
+
title?: string;
|
|
12
|
+
/**
|
|
13
|
+
* @description 标题颜色(默认#303133)
|
|
14
|
+
* */
|
|
15
|
+
titleColor?: string;
|
|
16
|
+
/**
|
|
17
|
+
* @description 标题字体大小,单位rpx(默认15px)
|
|
18
|
+
* */
|
|
19
|
+
titleSize?: string | number;
|
|
20
|
+
/**
|
|
21
|
+
* @description 头部右边的副标题
|
|
22
|
+
* */
|
|
23
|
+
subTitle?: string;
|
|
24
|
+
/**
|
|
25
|
+
* @description 副标题颜色(默认#909399)
|
|
26
|
+
* */
|
|
27
|
+
subTitleColor?: string;
|
|
28
|
+
/**
|
|
29
|
+
* @description 副标题字体大小(默认13px)
|
|
30
|
+
* */
|
|
31
|
+
subTitleSize?: string | number;
|
|
32
|
+
/**
|
|
33
|
+
* @description 是否显示边框(默认true)
|
|
34
|
+
* */
|
|
35
|
+
border?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* @description 用于标识点击了第几个卡片
|
|
38
|
+
* */
|
|
39
|
+
index?: string | number;
|
|
40
|
+
/**
|
|
41
|
+
* @description 卡片与屏幕两边和上下元素的间距,需带单位,如"30px 20px"(默认15px)
|
|
42
|
+
* */
|
|
43
|
+
margin?: string;
|
|
44
|
+
/**
|
|
45
|
+
* @description 卡片整体的圆角值,单位px(默认8px)
|
|
46
|
+
* */
|
|
47
|
+
borderRadius?: string | number;
|
|
48
|
+
/**
|
|
49
|
+
* @description 头部自定义样式,对象形式
|
|
50
|
+
* */
|
|
51
|
+
headStyle?: CSSProperties;
|
|
52
|
+
/**
|
|
53
|
+
* @description 中部自定义样式,对象形式
|
|
54
|
+
* */
|
|
55
|
+
bodyStyle?: CSSProperties;
|
|
56
|
+
/**
|
|
57
|
+
* @description 底部自定义样式,对象形式
|
|
58
|
+
* */
|
|
59
|
+
footStyle?: CSSProperties;
|
|
60
|
+
/**
|
|
61
|
+
* @description 是否显示头部的下边框(默认true)
|
|
62
|
+
* */
|
|
63
|
+
headBorderBottom?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* @description 是否显示底部的上边框(默认true)
|
|
66
|
+
* */
|
|
67
|
+
footBorderTop?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* @description 缩略图路径,如设置将显示在标题的左边,不建议使用相对路径
|
|
70
|
+
* */
|
|
71
|
+
thumb?: string;
|
|
72
|
+
/**
|
|
73
|
+
* @description 缩略图的宽度,高等于宽,单位px(默认30px)
|
|
74
|
+
* */
|
|
75
|
+
thumbWidth?: string | number;
|
|
76
|
+
/**
|
|
77
|
+
* @description 缩略图是否为圆形(默认false)
|
|
78
|
+
* */
|
|
79
|
+
thumbCircle?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* @description // 给head,body,foot的内边距
|
|
82
|
+
* */
|
|
83
|
+
padding?: string | number;
|
|
84
|
+
/**
|
|
85
|
+
* @description 头部内边距
|
|
86
|
+
* */
|
|
87
|
+
paddingHead?: string | number;
|
|
88
|
+
/**
|
|
89
|
+
* @description 中部内边距
|
|
90
|
+
* */
|
|
91
|
+
paddingBody?: string | number;
|
|
92
|
+
/**
|
|
93
|
+
* @description 尾部内边距
|
|
94
|
+
* */
|
|
95
|
+
paddingFoot?: string | number;
|
|
96
|
+
/**
|
|
97
|
+
* @description 是否显示头部(默认true)
|
|
98
|
+
* */
|
|
99
|
+
showHead?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* @description 是否显示尾部(默认true)
|
|
102
|
+
* */
|
|
103
|
+
showFoot?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* @description 卡片外围阴影,字符串形式(默认true)
|
|
106
|
+
* */
|
|
107
|
+
boxShadow?: string | boolean;
|
|
108
|
+
/**
|
|
109
|
+
* @description 定义需要用到的外部样式
|
|
110
|
+
* */
|
|
111
|
+
customStyle?: CSSProperties;
|
|
112
|
+
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :style="customStyle" class="hy-cell">
|
|
3
|
+
<view
|
|
4
|
+
class="hy-cell__title"
|
|
5
|
+
:style="{ borderBottom: titleBorder ? '1rpx solid #c8c7cc66' : '' }"
|
|
6
|
+
v-if="title || $slots['title']"
|
|
7
|
+
>
|
|
8
|
+
<slot name="title" :title="title">
|
|
9
|
+
<view class="hy-cell__title-nav">
|
|
10
|
+
<view
|
|
11
|
+
class="hy-cell__title-nav--ver"
|
|
12
|
+
:style="{ background: verticalColor }"
|
|
13
|
+
v-if="showVertical"
|
|
14
|
+
></view>
|
|
15
|
+
<text class="hy-cell__title-nav--text">{{ title }}</text>
|
|
16
|
+
</view>
|
|
17
|
+
</slot>
|
|
18
|
+
</view>
|
|
19
|
+
<view class="hy-cell__body">
|
|
20
|
+
<slot>
|
|
21
|
+
<template v-for="(item, i) in list" :key="i">
|
|
22
|
+
<view
|
|
23
|
+
class="hy-cell__body--container"
|
|
24
|
+
:hover-class="containerClass(item)"
|
|
25
|
+
:hover-stay-time="250"
|
|
26
|
+
:style="{ borderBottom: border ? '1rpx solid #c8c7cc66' : '' }"
|
|
27
|
+
@tap="clickHandler($event, item, i)"
|
|
28
|
+
>
|
|
29
|
+
<view class="hy-cell__body--container__content">
|
|
30
|
+
<view class="hy-cell__body--container__content-icon">
|
|
31
|
+
<slot name="icon" :icon="item?.icon">
|
|
32
|
+
<HyIcon
|
|
33
|
+
size="25"
|
|
34
|
+
:name="item?.icon"
|
|
35
|
+
:color="disabled || item?.disabled ? '#c0c0c0' : ''"
|
|
36
|
+
></HyIcon>
|
|
37
|
+
</slot>
|
|
38
|
+
</view>
|
|
39
|
+
<view class="hy-cell__body--container__content-title">
|
|
40
|
+
<!-- 将slot与默认内容用if/else分开主要是因为微信小程序不支持slot嵌套传递,这样才能解决collapse组件的slot不失效问题,label暂时未用到。 -->
|
|
41
|
+
<slot name="cell-title" :title="item?.title">
|
|
42
|
+
<text
|
|
43
|
+
class="hy-cell__body--container__content-title--text"
|
|
44
|
+
:class="[
|
|
45
|
+
(disabled || item?.disabled) && 'hy-cell--disabled'
|
|
46
|
+
]"
|
|
47
|
+
>{{ item?.title }}</text
|
|
48
|
+
>
|
|
49
|
+
</slot>
|
|
50
|
+
<slot name="sub" v-if="item?.subhead" :sub="item.subhead">
|
|
51
|
+
<text
|
|
52
|
+
class="hy-cell__body--container__content-title--sub"
|
|
53
|
+
:class="[disabled && 'hy-cell--disabled']"
|
|
54
|
+
>{{ item.subhead }}</text
|
|
55
|
+
>
|
|
56
|
+
</slot>
|
|
57
|
+
</view>
|
|
58
|
+
</view>
|
|
59
|
+
<view
|
|
60
|
+
class="hy-cell__body--container__center"
|
|
61
|
+
:style="{
|
|
62
|
+
justifyContent:
|
|
63
|
+
arrange === 'left'
|
|
64
|
+
? 'flex-start'
|
|
65
|
+
: arrange === 'right'
|
|
66
|
+
? 'flex-end'
|
|
67
|
+
: 'center'
|
|
68
|
+
}"
|
|
69
|
+
>
|
|
70
|
+
<slot name="value" :record="item">
|
|
71
|
+
<text
|
|
72
|
+
class="hy-cell__body--container__center__value"
|
|
73
|
+
:class="[disabled && 'hy-cell--disabled']"
|
|
74
|
+
v-if="value || item?.value"
|
|
75
|
+
>{{ item.value || value }}</text
|
|
76
|
+
>
|
|
77
|
+
</slot>
|
|
78
|
+
</view>
|
|
79
|
+
<view
|
|
80
|
+
class="hy-cell__body--container__right-icon"
|
|
81
|
+
:class="[
|
|
82
|
+
`hy-cell__body--container__right-icon--${
|
|
83
|
+
item?.arrowDirection || arrowDirection
|
|
84
|
+
}`
|
|
85
|
+
]"
|
|
86
|
+
>
|
|
87
|
+
<slot name="right-icon" :icon="item?.rightIcon || rightIcon">
|
|
88
|
+
<HyIcon
|
|
89
|
+
:name="item?.rightIcon || rightIcon"
|
|
90
|
+
:custom-style="rightIconStyle"
|
|
91
|
+
:color="disabled || item?.disabled ? '#c0c0c0' : 'info'"
|
|
92
|
+
:size="size === 'large' ? 18 : 16"
|
|
93
|
+
></HyIcon>
|
|
94
|
+
</slot>
|
|
95
|
+
</view>
|
|
96
|
+
</view>
|
|
97
|
+
|
|
98
|
+
<slot name="bottom" :record="item" />
|
|
99
|
+
</template>
|
|
100
|
+
</slot>
|
|
101
|
+
</view>
|
|
102
|
+
</view>
|
|
103
|
+
</template>
|
|
104
|
+
|
|
105
|
+
<script setup lang="ts">
|
|
106
|
+
import defaultProps from "./props";
|
|
107
|
+
import IProps, { CellContentVo } from "./typing";
|
|
108
|
+
|
|
109
|
+
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
110
|
+
import { computed, toRefs } from "vue";
|
|
111
|
+
|
|
112
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
113
|
+
const { disabled, clickable } = toRefs(props);
|
|
114
|
+
const emit = defineEmits(["click"]);
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @description 计算什么时候出现点击状态
|
|
118
|
+
* */
|
|
119
|
+
const containerClass = computed(() => {
|
|
120
|
+
return (temp: CellContentVo): string => {
|
|
121
|
+
return [
|
|
122
|
+
!disabled.value &&
|
|
123
|
+
!temp?.disabled &&
|
|
124
|
+
clickable.value &&
|
|
125
|
+
"hy-cell__body--container__clickable"
|
|
126
|
+
]
|
|
127
|
+
.filter(Boolean)
|
|
128
|
+
.join();
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @description 点击cell
|
|
134
|
+
* */
|
|
135
|
+
const clickHandler = (e: Event, temp: CellContentVo, index: number) => {
|
|
136
|
+
if (disabled.value) return;
|
|
137
|
+
emit("click", temp, index);
|
|
138
|
+
if (temp?.url) {
|
|
139
|
+
uni.navigateTo({
|
|
140
|
+
url: temp.url
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
e.stopPropagation();
|
|
144
|
+
};
|
|
145
|
+
</script>
|
|
146
|
+
|
|
147
|
+
<style lang="scss" scoped>
|
|
148
|
+
@import "../../libs/css/mixin.scss";
|
|
149
|
+
@import "../../theme.scss";
|
|
150
|
+
|
|
151
|
+
.hy-cell {
|
|
152
|
+
flex: 1;
|
|
153
|
+
|
|
154
|
+
/*标题*/
|
|
155
|
+
&__title {
|
|
156
|
+
padding: $hy-border-margin-padding-lg $hy-border-margin-padding-sm;
|
|
157
|
+
|
|
158
|
+
&-nav {
|
|
159
|
+
display: flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
|
|
162
|
+
&--ver {
|
|
163
|
+
border-radius: 4rpx;
|
|
164
|
+
width: 4px;
|
|
165
|
+
height: 20px;
|
|
166
|
+
margin-right: 16rpx;
|
|
167
|
+
}
|
|
168
|
+
&--text {
|
|
169
|
+
font-size: $hy-font-size-subtitle;
|
|
170
|
+
line-height: 16px;
|
|
171
|
+
color: $hy-color-title;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/*row内容*/
|
|
177
|
+
&__body {
|
|
178
|
+
/* #ifndef APP-NVUE */
|
|
179
|
+
box-sizing: border-box;
|
|
180
|
+
/* #endif */
|
|
181
|
+
font-size: $hy-font-size-paragraph;
|
|
182
|
+
color: $hy-color-paragraph;
|
|
183
|
+
// line-height: $u-cell-line-height;
|
|
184
|
+
align-items: center;
|
|
185
|
+
//justify-content: space-between;
|
|
186
|
+
|
|
187
|
+
&--container {
|
|
188
|
+
@include flex(row);
|
|
189
|
+
align-items: center;
|
|
190
|
+
justify-content: space-between;
|
|
191
|
+
flex: 1;
|
|
192
|
+
padding: $hy-border-margin-padding-lg $hy-border-margin-padding-base;
|
|
193
|
+
|
|
194
|
+
/*点击状态*/
|
|
195
|
+
&__clickable {
|
|
196
|
+
background-color: $hy-bg-color-grey;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&__content {
|
|
200
|
+
@include flex(row);
|
|
201
|
+
/*左边icon*/
|
|
202
|
+
&-icon {
|
|
203
|
+
@include flex();
|
|
204
|
+
align-items: center;
|
|
205
|
+
font-size: 16px;
|
|
206
|
+
margin-right: 10px;
|
|
207
|
+
}
|
|
208
|
+
/*行头部*/
|
|
209
|
+
&-title {
|
|
210
|
+
flex: $hy-font-size-subtitle;
|
|
211
|
+
line-height: 25px;
|
|
212
|
+
display: flex;
|
|
213
|
+
flex-direction: column;
|
|
214
|
+
|
|
215
|
+
/*标题*/
|
|
216
|
+
&--text {
|
|
217
|
+
font-size: $hy-font-size-lg;
|
|
218
|
+
line-height: 22px;
|
|
219
|
+
color: $hy-color-title;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/*sub值*/
|
|
223
|
+
&--sub {
|
|
224
|
+
margin-top: $hy-border-margin-padding-sm;
|
|
225
|
+
font-size: $hy-font-size-base;
|
|
226
|
+
color: $hy-text-color-grey;
|
|
227
|
+
line-height: 18px;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/*cell值*/
|
|
233
|
+
&__center {
|
|
234
|
+
@include flex();
|
|
235
|
+
max-width: 90%;
|
|
236
|
+
flex: 1;
|
|
237
|
+
&__value {
|
|
238
|
+
//text-align: right;
|
|
239
|
+
font-size: $hy-font-size-base;
|
|
240
|
+
line-height: 24px;
|
|
241
|
+
color: $hy-text-color-grey;
|
|
242
|
+
margin-right: $hy-border-margin-padding-sm;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/*右边icon*/
|
|
247
|
+
&__right-icon {
|
|
248
|
+
transition: transform 0.3s;
|
|
249
|
+
|
|
250
|
+
&--up {
|
|
251
|
+
transform: rotate(-90deg);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
&--down {
|
|
255
|
+
transform: rotate(90deg);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
&--disabled {
|
|
262
|
+
color: $hy-text-color-disable;
|
|
263
|
+
/* #ifndef APP-NVUE */
|
|
264
|
+
cursor: not-allowed;
|
|
265
|
+
/* #endif */
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import IProps from "./typing";
|
|
2
|
+
import { ColorConfig, IconConfig } from "../../config";
|
|
3
|
+
|
|
4
|
+
const defaultProps: IProps = {
|
|
5
|
+
list: [],
|
|
6
|
+
title: "",
|
|
7
|
+
titleBorder: false,
|
|
8
|
+
border: true,
|
|
9
|
+
verticalColor: ColorConfig.primary,
|
|
10
|
+
showVertical: true,
|
|
11
|
+
disabled: false,
|
|
12
|
+
clickable: false,
|
|
13
|
+
size: "medium",
|
|
14
|
+
value: "",
|
|
15
|
+
arrange: "right",
|
|
16
|
+
rightIcon: IconConfig.RIGHT,
|
|
17
|
+
arrowDirection: "left"
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default defaultProps;
|