@hlw-uni/mp-vue 2.1.34 → 2.1.35
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/package.json
CHANGED
|
@@ -425,18 +425,18 @@ defineOptions({
|
|
|
425
425
|
/* 浮动触发按钮 */
|
|
426
426
|
.trigger {
|
|
427
427
|
position: fixed;
|
|
428
|
-
right:
|
|
428
|
+
right: 32rpx;
|
|
429
429
|
bottom: 40rpx;
|
|
430
430
|
z-index: 100;
|
|
431
431
|
width: 66rpx;
|
|
432
432
|
height: 66rpx;
|
|
433
|
-
background:
|
|
434
|
-
color: #
|
|
433
|
+
background: rgba(248, 250, 252, 0.96);
|
|
434
|
+
color: #64748b;
|
|
435
435
|
border-radius: 50%;
|
|
436
|
+
border: 1rpx solid rgba(148, 163, 184, 0.32);
|
|
436
437
|
display: flex;
|
|
437
438
|
align-items: center;
|
|
438
439
|
justify-content: center;
|
|
439
|
-
box-shadow: 0 8rpx 24rpx rgba(15, 23, 42, 0.24);
|
|
440
440
|
}
|
|
441
441
|
|
|
442
442
|
.trigger--hover {
|
|
@@ -544,12 +544,11 @@ defineOptions({
|
|
|
544
544
|
bottom: 50rpx;
|
|
545
545
|
padding: 16rpx 26rpx;
|
|
546
546
|
background: rgba(255, 255, 255, 0.96);
|
|
547
|
-
border-radius:
|
|
547
|
+
border-radius: 16rpx;
|
|
548
548
|
display: flex;
|
|
549
549
|
flex-direction: column;
|
|
550
550
|
gap: 12rpx;
|
|
551
551
|
pointer-events: auto;
|
|
552
|
-
box-shadow: 0 8rpx 32rpx rgba(15, 23, 42, 0.18);
|
|
553
552
|
}
|
|
554
553
|
|
|
555
554
|
/* 模式行 */
|
|
@@ -84,7 +84,7 @@ interface Props {
|
|
|
84
84
|
borderColor?: string;
|
|
85
85
|
/** 边框线型:solid(默认)/ dashed / dotted / double */
|
|
86
86
|
borderStyle?: "solid" | "dashed" | "dotted" | "double";
|
|
87
|
-
/** 边框宽度,CSS 长度值,默认 `
|
|
87
|
+
/** 边框宽度,CSS 长度值,默认 `0.5rpx` */
|
|
88
88
|
borderWidth?: string;
|
|
89
89
|
/** 圆角大小,对应 CSS 变量体系 */
|
|
90
90
|
radius?: "none" | "sm" | "md" | "lg" | "xl";
|
|
@@ -169,29 +169,29 @@ const showDivider = computed(() => {
|
|
|
169
169
|
|
|
170
170
|
/* 边框 — width / style / color 全部走 CSS 变量,未设置时回落 */
|
|
171
171
|
&--bordered {
|
|
172
|
-
border-width: var(--card-border-width,
|
|
172
|
+
border-width: var(--card-border-width, 0.5rpx);
|
|
173
173
|
border-style: var(--card-border-style, solid);
|
|
174
174
|
border-color: var(--card-border-color, #e2e8f0);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
/* 边框 — 单边 */
|
|
178
178
|
&--border-top {
|
|
179
|
-
border-top-width: var(--card-border-width,
|
|
179
|
+
border-top-width: var(--card-border-width, 0.5rpx);
|
|
180
180
|
border-top-style: var(--card-border-style, solid);
|
|
181
181
|
border-top-color: var(--card-border-color, #e2e8f0);
|
|
182
182
|
}
|
|
183
183
|
&--border-right {
|
|
184
|
-
border-right-width: var(--card-border-width,
|
|
184
|
+
border-right-width: var(--card-border-width, 0.5rpx);
|
|
185
185
|
border-right-style: var(--card-border-style, solid);
|
|
186
186
|
border-right-color: var(--card-border-color, #e2e8f0);
|
|
187
187
|
}
|
|
188
188
|
&--border-bottom {
|
|
189
|
-
border-bottom-width: var(--card-border-width,
|
|
189
|
+
border-bottom-width: var(--card-border-width, 0.5rpx);
|
|
190
190
|
border-bottom-style: var(--card-border-style, solid);
|
|
191
191
|
border-bottom-color: var(--card-border-color, #e2e8f0);
|
|
192
192
|
}
|
|
193
193
|
&--border-left {
|
|
194
|
-
border-left-width: var(--card-border-width,
|
|
194
|
+
border-left-width: var(--card-border-width, 0.5rpx);
|
|
195
195
|
border-left-style: var(--card-border-style, solid);
|
|
196
196
|
border-left-color: var(--card-border-color, #e2e8f0);
|
|
197
197
|
}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view
|
|
2
|
+
<view
|
|
3
|
+
class="hlw-card-header"
|
|
4
|
+
:class="{ 'hlw-card-header--divider': divider }"
|
|
5
|
+
:style="headerStyle"
|
|
6
|
+
>
|
|
3
7
|
<view class="hlw-card-header__left">
|
|
4
8
|
<slot name="left">
|
|
5
9
|
<view v-if="icon" class="hlw-card-header__icon-box" :class="iconBoxClass">
|
|
6
10
|
<text class="hlw-card-header__icon" :class="icon" />
|
|
7
11
|
</view>
|
|
8
|
-
<text v-if="title" class="hlw-card-header__title">{{ title }}</text>
|
|
12
|
+
<text v-if="title" class="hlw-card-header__title" :style="titleStyle">{{ title }}</text>
|
|
9
13
|
</slot>
|
|
10
14
|
</view>
|
|
11
15
|
<view v-if="hasRight" class="hlw-card-header__right">
|
|
12
16
|
<slot name="right">
|
|
13
|
-
<text v-if="
|
|
17
|
+
<text v-if="descText" class="hlw-card-header__desc" :style="descStyle">{{ descText }}</text>
|
|
14
18
|
</slot>
|
|
15
19
|
</view>
|
|
16
20
|
</view>
|
|
@@ -27,7 +31,7 @@ import { computed, useSlots } from "vue";
|
|
|
27
31
|
* @example A. 直接当 <hlw-card> 的 default slot 子元素(注意把 hlw-card 的 padding 关掉,否则会双重 padding)
|
|
28
32
|
* ```vue
|
|
29
33
|
* <hlw-card :padding="false">
|
|
30
|
-
* <hlw-card-header title="标题" icon="i-fa6-solid-heart-pulse text-rose-500"
|
|
34
|
+
* <hlw-card-header title="标题" icon="i-fa6-solid-heart-pulse text-rose-500" desc="副标题" />
|
|
31
35
|
* <view style="padding: 24rpx 28rpx">body</view>
|
|
32
36
|
* </hlw-card>
|
|
33
37
|
* ```
|
|
@@ -36,7 +40,7 @@ import { computed, useSlots } from "vue";
|
|
|
36
40
|
* ```vue
|
|
37
41
|
* <hlw-card>
|
|
38
42
|
* <template #header>
|
|
39
|
-
* <hlw-card-header title="标题" icon="i-fa6-solid-star"
|
|
43
|
+
* <hlw-card-header title="标题" icon="i-fa6-solid-star" desc="副标题" />
|
|
40
44
|
* </template>
|
|
41
45
|
* body
|
|
42
46
|
* </hlw-card>
|
|
@@ -54,22 +58,62 @@ interface Props {
|
|
|
54
58
|
title?: string;
|
|
55
59
|
/** 图标 class(iconify 或自定义),如 `"i-fa6-solid-heart-pulse text-rose-500"` */
|
|
56
60
|
icon?: string;
|
|
57
|
-
/**
|
|
61
|
+
/** 右侧描述文字(无 right slot 时显示) */
|
|
62
|
+
desc?: string;
|
|
63
|
+
/** @deprecated 请使用 desc */
|
|
58
64
|
extra?: string;
|
|
65
|
+
/** 标题字号,支持 CSS 变量,如 `var(--font-md)` */
|
|
66
|
+
titleSize?: string;
|
|
67
|
+
/** 标题颜色 */
|
|
68
|
+
titleColor?: string;
|
|
69
|
+
/** 标题字重 */
|
|
70
|
+
titleWeight?: string | number;
|
|
71
|
+
/** 描述字号,支持 CSS 变量,如 `var(--font-xs)` */
|
|
72
|
+
descSize?: string;
|
|
73
|
+
/** 描述颜色 */
|
|
74
|
+
descColor?: string;
|
|
75
|
+
/** 描述字重 */
|
|
76
|
+
descWeight?: string | number;
|
|
59
77
|
/** 是否在头部底部显示虚线分隔线,默认 false。线型由 CSS 变量 `--card-header-divider-style`(默认 dashed)控制 */
|
|
60
78
|
divider?: boolean;
|
|
79
|
+
/** 头部背景色,如 `#f8fafc` / `rgba(248, 250, 252, 0.3)` */
|
|
80
|
+
bgColor?: string;
|
|
61
81
|
}
|
|
62
82
|
|
|
63
83
|
const props = withDefaults(defineProps<Props>(), {
|
|
64
84
|
title: "",
|
|
65
85
|
icon: "",
|
|
86
|
+
desc: "",
|
|
66
87
|
extra: "",
|
|
88
|
+
titleSize: "var(--font-30)",
|
|
89
|
+
titleColor: "",
|
|
90
|
+
titleWeight: "",
|
|
91
|
+
descSize: "var(--font-xs)",
|
|
92
|
+
descColor: "",
|
|
93
|
+
descWeight: "",
|
|
67
94
|
divider: false,
|
|
95
|
+
bgColor: "",
|
|
68
96
|
});
|
|
69
97
|
|
|
70
98
|
const slots = useSlots();
|
|
71
99
|
|
|
72
|
-
const
|
|
100
|
+
const descText = computed(() => props.desc || props.extra);
|
|
101
|
+
|
|
102
|
+
const hasRight = computed(() => !!(slots.right || descText.value));
|
|
103
|
+
|
|
104
|
+
const headerStyle = computed(() => (props.bgColor ? { backgroundColor: props.bgColor } : {}));
|
|
105
|
+
|
|
106
|
+
const titleStyle = computed(() => ({
|
|
107
|
+
fontSize: props.titleSize,
|
|
108
|
+
...(props.titleColor ? { color: props.titleColor } : {}),
|
|
109
|
+
...(props.titleWeight ? { fontWeight: String(props.titleWeight) } : {}),
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
const descStyle = computed(() => ({
|
|
113
|
+
fontSize: props.descSize,
|
|
114
|
+
...(props.descColor ? { color: props.descColor } : {}),
|
|
115
|
+
...(props.descWeight ? { fontWeight: String(props.descWeight) } : {}),
|
|
116
|
+
}));
|
|
73
117
|
|
|
74
118
|
const iconToneClass = computed(() => {
|
|
75
119
|
const value = props.icon;
|
|
@@ -97,7 +141,7 @@ defineOptions({
|
|
|
97
141
|
display: flex;
|
|
98
142
|
align-items: center;
|
|
99
143
|
justify-content: space-between;
|
|
100
|
-
padding:
|
|
144
|
+
padding: 26rpx 26rpx;
|
|
101
145
|
box-sizing: border-box;
|
|
102
146
|
|
|
103
147
|
}
|
|
@@ -162,22 +206,22 @@ defineOptions({
|
|
|
162
206
|
}
|
|
163
207
|
|
|
164
208
|
.hlw-card-header__icon {
|
|
165
|
-
font-size:
|
|
209
|
+
font-size: var(--font-xs);
|
|
166
210
|
}
|
|
167
211
|
|
|
168
212
|
.hlw-card-header__title {
|
|
169
|
-
font-size:
|
|
213
|
+
font-size: var(--font-base);
|
|
170
214
|
font-weight: 500;
|
|
171
215
|
color: var(--text-primary, #1e293b);
|
|
172
216
|
letter-spacing: 1rpx;
|
|
173
217
|
}
|
|
174
218
|
|
|
175
|
-
.hlw-card-
|
|
219
|
+
.hlw-card-header__desc {
|
|
176
220
|
padding: 4rpx 16rpx;
|
|
177
221
|
border-radius: var(--radius-sm, 8rpx);
|
|
178
222
|
background: rgba(241, 245, 249, 0.8);
|
|
179
223
|
color: var(--text-muted, #64748b);
|
|
180
|
-
font-size:
|
|
224
|
+
font-size: var(--font-xs);
|
|
181
225
|
font-weight: 400;
|
|
182
226
|
}
|
|
183
227
|
</style>
|