hy-app 0.4.13 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/hy-action-sheet/hy-action-sheet.vue +155 -238
- package/components/hy-action-sheet/props.ts +68 -15
- package/components/hy-action-sheet/typing.d.ts +115 -115
- package/components/hy-address-picker/hy-address-picker.vue +185 -289
- package/components/hy-address-picker/props.ts +97 -21
- package/components/hy-address-picker/typing.d.ts +90 -89
- package/components/hy-avatar/hy-avatar.vue +121 -204
- package/components/hy-avatar/props.ts +76 -18
- package/components/hy-avatar/typing.d.ts +63 -62
- package/components/hy-back-top/hy-back-top.vue +65 -120
- package/components/hy-back-top/props.ts +57 -16
- package/components/hy-back-top/typing.d.ts +43 -42
- package/components/hy-badge/hy-badge.vue +66 -138
- package/components/hy-badge/props.ts +73 -17
- package/components/hy-badge/typing.d.ts +59 -58
- package/components/hy-button/hy-button.vue +226 -375
- package/components/hy-button/props.ts +129 -158
- package/components/hy-calendar/header.vue +48 -64
- package/components/hy-calendar/hy-calendar.vue +274 -438
- package/components/hy-calendar/month.vue +508 -516
- package/components/hy-calendar/props.ts +157 -35
- package/components/hy-calendar/typing.d.ts +129 -128
- package/components/hy-card/hy-card.vue +118 -240
- package/components/hy-card/index.scss +1 -2
- package/components/hy-card/props.ts +122 -27
- package/components/hy-card/typing.d.ts +119 -118
- package/components/hy-cell/hy-cell.vue +176 -258
- package/components/hy-cell/props.ts +71 -17
- package/components/hy-cell/typing.d.ts +87 -86
- package/components/hy-check-button/hy-check-button.vue +69 -139
- package/components/hy-check-button/props.ts +72 -18
- package/components/hy-check-button/typing.d.ts +74 -73
- package/components/hy-checkbox/hy-checkbox.vue +170 -263
- package/components/hy-checkbox/props.ts +94 -24
- package/components/hy-checkbox/typing.d.ts +72 -72
- package/components/hy-checkbox-group/hy-checkbox-group.vue +25 -100
- package/components/hy-checkbox-group/props.ts +80 -0
- package/components/hy-checkbox-group/typing.d.ts +65 -65
- package/components/hy-checkbox-item/hy-checkbox-item.vue +140 -177
- package/components/hy-checkbox-item/props.ts +24 -0
- package/components/hy-checkbox-item/typing.d.ts +4 -3
- package/components/hy-code-input/hy-code-input.vue +179 -262
- package/components/hy-code-input/props.ts +84 -18
- package/components/hy-code-input/typing.d.ts +71 -71
- package/components/hy-config-provider/hy-config-provider.vue +28 -50
- package/components/hy-config-provider/props.ts +26 -11
- package/components/hy-config-provider/typing.d.ts +20 -20
- package/components/hy-count-down/hy-count-down.vue +103 -131
- package/components/hy-count-down/props.ts +30 -8
- package/components/hy-count-down/typing.d.ts +25 -25
- package/components/hy-count-to/hy-count-to.vue +148 -213
- package/components/hy-count-to/props.ts +60 -15
- package/components/hy-count-to/typing.d.ts +46 -46
- package/components/hy-coupon/README.md +133 -0
- package/components/hy-coupon/hy-coupon.vue +180 -0
- package/components/hy-coupon/index.scss +553 -0
- package/components/hy-coupon/props.ts +129 -0
- package/components/hy-coupon/typing.d.ts +146 -0
- package/components/hy-datetime-picker/hy-datetime-picker.vue +415 -580
- package/components/hy-datetime-picker/props.ts +142 -32
- package/components/hy-datetime-picker/typing.d.ts +132 -132
- package/components/hy-divider/hy-divider.vue +90 -169
- package/components/hy-divider/props.ts +78 -19
- package/components/hy-divider/typing.d.ts +60 -60
- package/components/hy-dropdown/hy-dropdown.vue +37 -71
- package/components/hy-dropdown/props.ts +38 -15
- package/components/hy-dropdown/typing.d.ts +44 -44
- package/components/hy-dropdown-item/hy-dropdown-item.vue +141 -173
- package/components/hy-dropdown-item/props.ts +19 -8
- package/components/hy-empty/hy-empty.vue +75 -129
- package/components/hy-empty/props.ts +57 -15
- package/components/hy-empty/typing.d.ts +84 -84
- package/components/hy-flex/hy-flex.vue +33 -88
- package/components/hy-flex/props.ts +58 -0
- package/components/hy-flex/typing.d.ts +14 -16
- package/components/hy-float-button/hy-float-button.vue +289 -406
- package/components/hy-float-button/props.ts +109 -25
- package/components/hy-folding-panel/hy-folding-panel.vue +86 -374
- package/components/hy-folding-panel/props.ts +40 -15
- package/components/hy-folding-panel/typing.d.ts +52 -63
- package/components/hy-folding-panel-item/hy-folding-panel-item.vue +186 -228
- package/components/hy-folding-panel-item/index.scss +87 -0
- package/components/hy-folding-panel-item/props.ts +81 -0
- package/components/hy-folding-panel-item/typing.d.ts +23 -0
- package/components/hy-form/hy-form.vue +172 -212
- package/components/hy-form/props.ts +37 -0
- package/components/hy-form/typing.d.ts +68 -61
- package/components/hy-form-group/typing.d.ts +74 -74
- package/components/hy-form-item/hy-form-item.vue +100 -129
- package/components/hy-form-item/props.ts +25 -0
- package/components/hy-form-item/typing.d.ts +40 -37
- package/components/hy-grid/hy-grid.vue +76 -132
- package/components/hy-grid/props.ts +58 -16
- package/components/hy-grid/typing.d.ts +66 -66
- package/components/hy-icon/hy-icon.vue +84 -161
- package/components/hy-icon/props.ts +76 -22
- package/components/hy-icon/typing.d.ts +83 -82
- package/components/hy-image/hy-image.vue +142 -272
- package/components/hy-image/props.ts +105 -23
- package/components/hy-image/typing.d.ts +84 -87
- package/components/hy-input/hy-input.vue +230 -421
- package/components/hy-input/props.ts +183 -35
- package/components/hy-input/typing.d.ts +169 -169
- package/components/hy-line/hy-line.vue +34 -72
- package/components/hy-line/props.ts +41 -10
- package/components/hy-line/typing.d.ts +29 -29
- package/components/hy-line-progress/hy-line-progress.vue +66 -101
- package/components/hy-line-progress/props.ts +31 -10
- package/components/hy-line-progress/typing.d.ts +29 -29
- package/components/hy-list/hy-list.vue +151 -220
- package/components/hy-list/props.ts +67 -16
- package/components/hy-list/typing.d.ts +52 -52
- package/components/hy-loading/hy-loading.vue +63 -119
- package/components/hy-loading/props.ts +63 -15
- package/components/hy-loading/typing.d.ts +49 -49
- package/components/hy-menu/hy-menu.vue +124 -166
- package/components/hy-menu/props.ts +42 -10
- package/components/hy-menu/typing.d.ts +60 -60
- package/components/hy-modal/hy-modal.vue +127 -218
- package/components/hy-modal/props.ts +89 -24
- package/components/hy-navbar/hy-navbar.vue +104 -177
- package/components/hy-navbar/props.ts +76 -22
- package/components/hy-navbar/typing.d.ts +81 -81
- package/components/hy-notice-bar/hy-notice-bar.vue +67 -144
- package/components/hy-notice-bar/props.ts +80 -19
- package/components/hy-notice-bar/typing.d.ts +62 -62
- package/components/hy-notify/hy-notify.vue +128 -177
- package/components/hy-notify/props.ts +49 -12
- package/components/hy-notify/typing.d.ts +45 -41
- package/components/hy-number-step/hy-number-step.vue +281 -394
- package/components/hy-number-step/props.ts +110 -27
- package/components/hy-number-step/typing.d.ts +120 -120
- package/components/hy-overlay/hy-overlay.vue +39 -66
- package/components/hy-overlay/props.ts +31 -8
- package/components/hy-pagination/hy-pagination.vue +100 -155
- package/components/hy-pagination/props.ts +53 -13
- package/components/hy-picker/hy-picker.vue +309 -430
- package/components/hy-picker/index.scss +8 -12
- package/components/hy-picker/props.ts +110 -26
- package/components/hy-popover/hy-popover.vue +190 -252
- package/components/hy-popover/props.ts +48 -10
- package/components/hy-popup/hy-popup.vue +162 -248
- package/components/hy-popup/props.ts +82 -18
- package/components/hy-price/hy-price.vue +45 -104
- package/components/hy-price/props.ts +52 -12
- package/components/hy-price/typing.d.ts +41 -36
- package/components/hy-qrcode/hy-qrcode.vue +115 -185
- package/components/hy-qrcode/props.ts +68 -18
- package/components/hy-qrcode/typing.d.ts +67 -66
- package/components/hy-radio/hy-radio.vue +161 -259
- package/components/hy-radio/props.ts +95 -25
- package/components/hy-radio/typing.d.ts +85 -84
- package/components/hy-rate/hy-rate.vue +185 -270
- package/components/hy-rate/props.ts +76 -18
- package/components/hy-rate/typing.d.ts +61 -60
- package/components/hy-read-more/hy-read-more.vue +93 -136
- package/components/hy-read-more/props.ts +43 -13
- package/components/hy-scroll-list/hy-scroll-list.vue +81 -102
- package/components/hy-scroll-list/props.ts +22 -11
- package/components/hy-search/hy-search.vue +155 -284
- package/components/hy-search/props.ts +130 -25
- package/components/hy-signature/hy-signature.vue +491 -635
- package/components/hy-signature/props.ts +115 -26
- package/components/hy-signature/typing.d.ts +138 -138
- package/components/hy-slider/hy-slider.vue +388 -477
- package/components/hy-slider/props.ts +75 -19
- package/components/hy-steps/hy-steps.vue +212 -279
- package/components/hy-steps/props.ts +47 -13
- package/components/hy-submit-bar/hy-submit-bar.vue +137 -222
- package/components/hy-submit-bar/props.ts +89 -20
- package/components/hy-submit-bar/typing.d.ts +86 -85
- package/components/hy-subsection/hy-subsection.vue +132 -185
- package/components/hy-subsection/props.ts +50 -17
- package/components/hy-subsection/typing.d.ts +52 -52
- package/components/hy-swipe-action/hy-swipe-action.vue +228 -283
- package/components/hy-swipe-action/props.ts +43 -18
- package/components/hy-swipe-action/typing.d.ts +46 -46
- package/components/hy-swiper/hy-swiper.vue +159 -286
- package/components/hy-swiper/props.ts +126 -28
- package/components/hy-swiper/typing.d.ts +115 -115
- package/components/hy-switch/hy-switch.vue +112 -176
- package/components/hy-switch/props.ts +60 -15
- package/components/hy-switch/typing.d.ts +63 -63
- package/components/hy-tabBar/hy-tabBar.vue +64 -60
- package/components/hy-tabs/hy-tabs.vue +277 -380
- package/components/hy-tabs/props.ts +75 -18
- package/components/hy-tag/hy-tag.vue +111 -204
- package/components/hy-tag/props.ts +81 -19
- package/components/hy-text/hy-text.vue +200 -322
- package/components/hy-text/props.ts +107 -28
- package/components/hy-textarea/hy-textarea.vue +147 -256
- package/components/hy-textarea/props.ts +112 -25
- package/components/hy-textarea/typing.d.ts +42 -42
- package/components/hy-toast/hy-toast.vue +135 -143
- package/components/hy-tooltip/hy-tooltip.vue +220 -306
- package/components/hy-tooltip/props.ts +79 -15
- package/components/hy-transition/hy-transition.vue +111 -138
- package/components/hy-transition/props.ts +30 -8
- package/components/hy-upload/hy-upload.vue +320 -469
- package/components/hy-upload/props.ts +130 -27
- package/components/hy-warn/hy-warn.vue +80 -129
- package/components/hy-warn/props.ts +47 -12
- package/components/hy-waterfall/hy-waterfall.vue +139 -163
- package/components/hy-waterfall/props.ts +19 -7
- package/components/hy-watermark/hy-watermark.vue +762 -870
- package/components/hy-watermark/props.ts +103 -22
- package/global.d.ts +2 -0
- package/libs/css/theme.scss +3 -3
- package/package.json +2 -2
- package/web-types.json +1 -1
- package/components/hy-folding-panel/index.scss +0 -9
|
@@ -1,282 +1,160 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
+
<!-- @slot 头部插槽 -->
|
|
13
|
+
<slot v-if="$slots.header" name="header" />
|
|
14
|
+
<view v-else class="hy-card--head__flex">
|
|
15
|
+
<view class="hy-card--head__left">
|
|
16
|
+
<hy-icon
|
|
17
|
+
v-if="thumb"
|
|
18
|
+
:name="thumb"
|
|
19
|
+
custom-class="hy-card--head__left__thumb"
|
|
20
|
+
:height="thumbWidth"
|
|
21
|
+
:width="thumbWidth"
|
|
22
|
+
:round="thumbCircle ? '50%' : '4px'"
|
|
23
|
+
></hy-icon>
|
|
24
|
+
<view>
|
|
25
|
+
<view
|
|
26
|
+
v-if="title"
|
|
27
|
+
class="hy-card--head__left__title"
|
|
28
|
+
:style="{
|
|
29
|
+
fontSize: addUnit(titleSize),
|
|
30
|
+
color: titleColor
|
|
31
|
+
}"
|
|
32
|
+
>
|
|
33
|
+
{{ title }}
|
|
34
|
+
</view>
|
|
35
|
+
<text
|
|
36
|
+
v-if="subTitle"
|
|
37
|
+
class="hy-card--head__left__sub"
|
|
38
|
+
:style="{
|
|
39
|
+
fontSize: addUnit(subTitleSize),
|
|
40
|
+
color: subTitleColor
|
|
41
|
+
}"
|
|
42
|
+
>
|
|
43
|
+
{{ subTitle }}
|
|
44
|
+
</text>
|
|
45
|
+
</view>
|
|
46
|
+
</view>
|
|
47
|
+
<view class="hy-card--head__right" v-if="subTitle">
|
|
48
|
+
<text
|
|
49
|
+
class="hy-card--head__right__text"
|
|
50
|
+
:style="{
|
|
51
|
+
fontSize: addUnit(rightTextSize),
|
|
52
|
+
color: rightTextColor
|
|
53
|
+
}"
|
|
54
|
+
>
|
|
55
|
+
{{ rightText }}
|
|
56
|
+
</text>
|
|
57
|
+
</view>
|
|
34
58
|
</view>
|
|
35
|
-
<text
|
|
36
|
-
v-if="subTitle"
|
|
37
|
-
class="hy-card--head__left__sub"
|
|
38
|
-
:style="{
|
|
39
|
-
fontSize: addUnit(subTitleSize),
|
|
40
|
-
color: subTitleColor,
|
|
41
|
-
}"
|
|
42
|
-
>
|
|
43
|
-
{{ subTitle }}
|
|
44
|
-
</text>
|
|
45
|
-
</view>
|
|
46
59
|
</view>
|
|
47
|
-
<view
|
|
48
|
-
|
|
49
|
-
class="hy-
|
|
50
|
-
:style="{
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
<view
|
|
61
|
+
@tap="bodyClick"
|
|
62
|
+
class="hy-card__body"
|
|
63
|
+
:style="[{ padding: addUnit(paddingBody || padding) }, bodyStyle]"
|
|
64
|
+
>
|
|
65
|
+
<!-- @slot 中间内容插槽 -->
|
|
66
|
+
<slot name="body" />
|
|
67
|
+
</view>
|
|
68
|
+
<view
|
|
69
|
+
v-if="showFoot"
|
|
70
|
+
class="hy-card__foot"
|
|
71
|
+
@tap="footClick"
|
|
72
|
+
:style="[{ padding: $slots.footer ? addUnit(paddingFoot || padding) : 0 }, footStyle]"
|
|
73
|
+
:class="{
|
|
74
|
+
'hy-border__top': footBorderTop
|
|
53
75
|
}"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
76
|
+
>
|
|
77
|
+
<!-- @slot 底部插槽 -->
|
|
78
|
+
<slot name="footer" />
|
|
57
79
|
</view>
|
|
58
|
-
</view>
|
|
59
|
-
</view>
|
|
60
|
-
<view
|
|
61
|
-
@tap="bodyClick"
|
|
62
|
-
class="hy-card__body"
|
|
63
|
-
:style="[{ padding: addUnit(paddingBody || padding) }, bodyStyle]"
|
|
64
|
-
>
|
|
65
|
-
<!-- @slot 中间内容插槽 -->
|
|
66
|
-
<slot name="body" />
|
|
67
80
|
</view>
|
|
68
|
-
<view
|
|
69
|
-
v-if="showFoot"
|
|
70
|
-
class="hy-card__foot"
|
|
71
|
-
@tap="footClick"
|
|
72
|
-
:style="[
|
|
73
|
-
{ padding: $slots.footer ? addUnit(paddingFoot || padding) : 0 },
|
|
74
|
-
footStyle,
|
|
75
|
-
]"
|
|
76
|
-
:class="{
|
|
77
|
-
'hy-border__top': footBorderTop,
|
|
78
|
-
}"
|
|
79
|
-
>
|
|
80
|
-
<!-- @slot 底部插槽 -->
|
|
81
|
-
<slot name="footer" />
|
|
82
|
-
</view>
|
|
83
|
-
</view>
|
|
84
81
|
</template>
|
|
85
82
|
|
|
86
83
|
<script lang="ts">
|
|
87
84
|
export default {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
85
|
+
name: 'hy-card',
|
|
86
|
+
options: {
|
|
87
|
+
addGlobalClass: true,
|
|
88
|
+
virtualHost: true,
|
|
89
|
+
styleIsolation: 'shared'
|
|
90
|
+
}
|
|
91
|
+
}
|
|
95
92
|
</script>
|
|
96
93
|
|
|
97
94
|
<script setup lang="ts">
|
|
98
|
-
import { computed } from
|
|
99
|
-
import type {
|
|
100
|
-
import
|
|
101
|
-
import
|
|
102
|
-
|
|
95
|
+
import { computed } from 'vue'
|
|
96
|
+
import type { ICardEmits } from './typing'
|
|
97
|
+
import { addUnit, getPx } from '../../libs'
|
|
98
|
+
import cardProps from './props'
|
|
103
99
|
// 组件
|
|
104
|
-
import HyIcon from
|
|
100
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
105
101
|
|
|
106
102
|
/**
|
|
107
103
|
* 卡片组件一般用于多个列表条目,且风格统一的场景。
|
|
108
104
|
* @displayName hy-card
|
|
109
105
|
*/
|
|
110
|
-
defineOptions({})
|
|
106
|
+
defineOptions({})
|
|
111
107
|
|
|
112
108
|
// const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
113
|
-
const props = defineProps(
|
|
114
|
-
|
|
115
|
-
full: {
|
|
116
|
-
type: Boolean,
|
|
117
|
-
default: false,
|
|
118
|
-
},
|
|
119
|
-
/** 头部左边的标题 */
|
|
120
|
-
title: String,
|
|
121
|
-
/** 标题颜色 */
|
|
122
|
-
titleColor: String,
|
|
123
|
-
/** 标题字体大小,单位rpx */
|
|
124
|
-
titleSize: {
|
|
125
|
-
type: String,
|
|
126
|
-
default: "18px",
|
|
127
|
-
},
|
|
128
|
-
/** 头部右边的副标题 */
|
|
129
|
-
subTitle: String,
|
|
130
|
-
/** 副标题颜色 */
|
|
131
|
-
subTitleColor: {
|
|
132
|
-
type: String,
|
|
133
|
-
default: "",
|
|
134
|
-
},
|
|
135
|
-
/** 副标题字体大小 */
|
|
136
|
-
subTitleSize: {
|
|
137
|
-
type: [String, Number],
|
|
138
|
-
default: 13,
|
|
139
|
-
},
|
|
140
|
-
/** 右边内容 */
|
|
141
|
-
rightText: {
|
|
142
|
-
type: String,
|
|
143
|
-
default: "",
|
|
144
|
-
},
|
|
145
|
-
/** 右边内容颜色 */
|
|
146
|
-
rightTextColor: {
|
|
147
|
-
type: String,
|
|
148
|
-
default: "",
|
|
149
|
-
},
|
|
150
|
-
/** 右边内容字体大小 */
|
|
151
|
-
rightTextSize: {
|
|
152
|
-
type: [String, Number],
|
|
153
|
-
default: "",
|
|
154
|
-
},
|
|
155
|
-
/** 是否显示边框 */
|
|
156
|
-
border: {
|
|
157
|
-
type: Boolean,
|
|
158
|
-
default: false,
|
|
159
|
-
},
|
|
160
|
-
/** 用于标识点击了第几个卡片 */
|
|
161
|
-
index: [String, Number],
|
|
162
|
-
/** 卡片与屏幕两边和上下元素的间距,需带单位,如"30px 20px" */
|
|
163
|
-
margin: {
|
|
164
|
-
type: String,
|
|
165
|
-
default: "0 0 20rpx",
|
|
166
|
-
},
|
|
167
|
-
/** 卡片整体的圆角值,单位px */
|
|
168
|
-
borderRadius: {
|
|
169
|
-
type: [String, Number],
|
|
170
|
-
default: 8,
|
|
171
|
-
},
|
|
172
|
-
/** 是否显示头部的下边框 */
|
|
173
|
-
headBorderBottom: {
|
|
174
|
-
type: Boolean,
|
|
175
|
-
default: false,
|
|
176
|
-
},
|
|
177
|
-
/** 是否显示底部的上边框 */
|
|
178
|
-
footBorderTop: {
|
|
179
|
-
type: Boolean,
|
|
180
|
-
default: false,
|
|
181
|
-
},
|
|
182
|
-
/** 缩略图路径,如设置将显示在标题的左边,不建议使用相对路径 */
|
|
183
|
-
thumb: String,
|
|
184
|
-
/** 缩略图的宽度,高等于宽,单位px */
|
|
185
|
-
thumbWidth: {
|
|
186
|
-
type: [String, Number],
|
|
187
|
-
default: 30,
|
|
188
|
-
},
|
|
189
|
-
/** 缩略图是否为圆形 */
|
|
190
|
-
thumbCircle: {
|
|
191
|
-
type: Boolean,
|
|
192
|
-
default: false,
|
|
193
|
-
},
|
|
194
|
-
/** 给head,body,foot的内边距 */
|
|
195
|
-
padding: {
|
|
196
|
-
type: [String, Number],
|
|
197
|
-
default: 15,
|
|
198
|
-
},
|
|
199
|
-
/** 头部内边距 */
|
|
200
|
-
paddingHead: [String, Number],
|
|
201
|
-
/** 中部内边距 */
|
|
202
|
-
paddingBody: [String, Number],
|
|
203
|
-
/** 尾部内边距 */
|
|
204
|
-
paddingFoot: [String, Number],
|
|
205
|
-
/** 是否显示头部 */
|
|
206
|
-
showHead: {
|
|
207
|
-
type: Boolean,
|
|
208
|
-
default: true,
|
|
209
|
-
},
|
|
210
|
-
/** 是否显示尾部 */
|
|
211
|
-
showFoot: {
|
|
212
|
-
type: Boolean,
|
|
213
|
-
default: true,
|
|
214
|
-
},
|
|
215
|
-
/** 卡片外围阴影,字符串形式 */
|
|
216
|
-
boxShadow: {
|
|
217
|
-
type: [Boolean, String],
|
|
218
|
-
default: true,
|
|
219
|
-
},
|
|
220
|
-
/** 头部自定义样式,对象形式 */
|
|
221
|
-
headStyle: Object as unknown as PropType<CSSProperties>,
|
|
222
|
-
/** 中部自定义样式 */
|
|
223
|
-
bodyStyle: Object as unknown as PropType<CSSProperties>,
|
|
224
|
-
/** 底部自定义样式 */
|
|
225
|
-
footStyle: Object as unknown as PropType<CSSProperties>,
|
|
226
|
-
/** 定义需要用到的外部样式 */
|
|
227
|
-
customStyle: {
|
|
228
|
-
type: Object as PropType<CSSProperties>,
|
|
229
|
-
default: () => {},
|
|
230
|
-
},
|
|
231
|
-
});
|
|
232
|
-
const emit = defineEmits<ICardEmits>();
|
|
109
|
+
const props = defineProps(cardProps)
|
|
110
|
+
const emit = defineEmits<ICardEmits>()
|
|
233
111
|
|
|
234
112
|
const cardClass = computed(() => {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
})
|
|
113
|
+
const hasBorder = getPx(props.borderRadius) > 0
|
|
114
|
+
return [
|
|
115
|
+
props.border && 'hy-border',
|
|
116
|
+
props.full && 'hy-card--full',
|
|
117
|
+
hasBorder && 'hy-card--border'
|
|
118
|
+
].filter(Boolean)
|
|
119
|
+
})
|
|
242
120
|
const cardStyle = computed(() => {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
})
|
|
121
|
+
return Object.assign(
|
|
122
|
+
{
|
|
123
|
+
borderRadius: addUnit(props.borderRadius),
|
|
124
|
+
margin: props.margin,
|
|
125
|
+
boxShadow: props.boxShadow
|
|
126
|
+
? typeof props.boxShadow === 'boolean'
|
|
127
|
+
? '0 0 10rpx 4rpx rgba(0, 0, 0, 0.16)'
|
|
128
|
+
: props.boxShadow
|
|
129
|
+
: ''
|
|
130
|
+
},
|
|
131
|
+
props.customStyle
|
|
132
|
+
)
|
|
133
|
+
})
|
|
256
134
|
|
|
257
135
|
const click = () => {
|
|
258
|
-
|
|
259
|
-
}
|
|
136
|
+
emit('click', props.index)
|
|
137
|
+
}
|
|
260
138
|
/**
|
|
261
139
|
* @description 点击头部
|
|
262
140
|
* */
|
|
263
141
|
const headClick = () => {
|
|
264
|
-
|
|
265
|
-
}
|
|
142
|
+
emit('head-click', props.index)
|
|
143
|
+
}
|
|
266
144
|
/**
|
|
267
145
|
* @description 点击身体
|
|
268
146
|
* */
|
|
269
147
|
const bodyClick = () => {
|
|
270
|
-
|
|
271
|
-
}
|
|
148
|
+
emit('body-click', props.index)
|
|
149
|
+
}
|
|
272
150
|
/**
|
|
273
151
|
* @description 点击尾部
|
|
274
152
|
* */
|
|
275
153
|
const footClick = () => {
|
|
276
|
-
|
|
277
|
-
}
|
|
154
|
+
emit('foot-click', props.index)
|
|
155
|
+
}
|
|
278
156
|
</script>
|
|
279
157
|
|
|
280
158
|
<style lang="scss" scoped>
|
|
281
|
-
@import
|
|
159
|
+
@import './index.scss';
|
|
282
160
|
</style>
|
|
@@ -10,10 +10,8 @@
|
|
|
10
10
|
box-sizing: border-box;
|
|
11
11
|
|
|
12
12
|
@include m(full) {
|
|
13
|
-
// 如果是与屏幕之间不留空隙,应该设置左右边距为0
|
|
14
13
|
margin-left: $hy-border-margin-padding-base !important;
|
|
15
14
|
margin-right: $hy-border-margin-padding-base !important;
|
|
16
|
-
width: 100%;
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
@include m(border) {
|
|
@@ -41,6 +39,7 @@
|
|
|
41
39
|
|
|
42
40
|
@include e(title) {
|
|
43
41
|
max-width: 450rpx;
|
|
42
|
+
font-size: $hy-font-size-base;
|
|
44
43
|
@include lineEllipsis;
|
|
45
44
|
}
|
|
46
45
|
|
|
@@ -1,29 +1,124 @@
|
|
|
1
|
-
import type IProps from
|
|
1
|
+
import type IProps from './typing'
|
|
2
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
4
|
+
const cardProps = {
|
|
5
|
+
/** 卡片与屏幕两侧是否留空隙,false-不留缝隙,true-有margin */
|
|
6
|
+
full: {
|
|
7
|
+
type: Boolean,
|
|
8
|
+
default: false
|
|
9
|
+
},
|
|
10
|
+
/** 头部左边的标题 */
|
|
11
|
+
title: String,
|
|
12
|
+
/** 标题颜色 */
|
|
13
|
+
titleColor: String,
|
|
14
|
+
/** 标题字体大小,单位rpx */
|
|
15
|
+
titleSize: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: ''
|
|
18
|
+
},
|
|
19
|
+
/** 头部右边的副标题 */
|
|
20
|
+
subTitle: String,
|
|
21
|
+
/** 副标题颜色 */
|
|
22
|
+
subTitleColor: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: ''
|
|
25
|
+
},
|
|
26
|
+
/** 副标题字体大小 */
|
|
27
|
+
subTitleSize: {
|
|
28
|
+
type: [String, Number],
|
|
29
|
+
default: ''
|
|
30
|
+
},
|
|
31
|
+
/** 右边内容 */
|
|
32
|
+
rightText: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: ''
|
|
35
|
+
},
|
|
36
|
+
/** 右边内容颜色 */
|
|
37
|
+
rightTextColor: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: ''
|
|
40
|
+
},
|
|
41
|
+
/** 右边内容字体大小 */
|
|
42
|
+
rightTextSize: {
|
|
43
|
+
type: [String, Number],
|
|
44
|
+
default: ''
|
|
45
|
+
},
|
|
46
|
+
/** 是否显示边框 */
|
|
47
|
+
border: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
/** 用于标识点击了第几个卡片 */
|
|
52
|
+
index: [String, Number],
|
|
53
|
+
/** 卡片与屏幕两边和上下元素的间距,需带单位,如"30px 20px" */
|
|
54
|
+
margin: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: '0 0 20rpx'
|
|
57
|
+
},
|
|
58
|
+
/** 卡片整体的圆角值,单位px */
|
|
59
|
+
borderRadius: {
|
|
60
|
+
type: [String, Number],
|
|
61
|
+
default: 8
|
|
62
|
+
},
|
|
63
|
+
/** 是否显示头部的下边框 */
|
|
64
|
+
headBorderBottom: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: false
|
|
67
|
+
},
|
|
68
|
+
/** 是否显示底部的上边框 */
|
|
69
|
+
footBorderTop: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false
|
|
72
|
+
},
|
|
73
|
+
/** 缩略图路径,如设置将显示在标题的左边,不建议使用相对路径 */
|
|
74
|
+
thumb: String,
|
|
75
|
+
/** 缩略图的宽度,高等于宽,单位px */
|
|
76
|
+
thumbWidth: {
|
|
77
|
+
type: [String, Number],
|
|
78
|
+
default: 30
|
|
79
|
+
},
|
|
80
|
+
/** 缩略图是否为圆形 */
|
|
81
|
+
thumbCircle: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: false
|
|
84
|
+
},
|
|
85
|
+
/** 给head,body,foot的内边距 */
|
|
86
|
+
padding: {
|
|
87
|
+
type: [String, Number],
|
|
88
|
+
default: 15
|
|
89
|
+
},
|
|
90
|
+
/** 头部内边距 */
|
|
91
|
+
paddingHead: [String, Number],
|
|
92
|
+
/** 中部内边距 */
|
|
93
|
+
paddingBody: [String, Number],
|
|
94
|
+
/** 尾部内边距 */
|
|
95
|
+
paddingFoot: [String, Number],
|
|
96
|
+
/** 是否显示头部 */
|
|
97
|
+
showHead: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: true
|
|
100
|
+
},
|
|
101
|
+
/** 是否显示尾部 */
|
|
102
|
+
showFoot: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: true
|
|
105
|
+
},
|
|
106
|
+
/** 卡片外围阴影,字符串形式 */
|
|
107
|
+
boxShadow: {
|
|
108
|
+
type: [Boolean, String],
|
|
109
|
+
default: true
|
|
110
|
+
},
|
|
111
|
+
/** 头部自定义样式,对象形式 */
|
|
112
|
+
headStyle: Object as PropType<CSSProperties>,
|
|
113
|
+
/** 中部自定义样式 */
|
|
114
|
+
bodyStyle: Object as PropType<CSSProperties>,
|
|
115
|
+
/** 底部自定义样式 */
|
|
116
|
+
footStyle: Object as PropType<CSSProperties>,
|
|
117
|
+
/** 定义需要用到的外部样式 */
|
|
118
|
+
customStyle: {
|
|
119
|
+
type: Object as PropType<CSSProperties>,
|
|
120
|
+
default: () => {}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
28
123
|
|
|
29
|
-
export default
|
|
124
|
+
export default cardProps
|