@hlw-uni/mp-vue 2.1.33 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hlw-uni/mp-vue",
3
- "version": "2.1.33",
3
+ "version": "2.1.35",
4
4
  "description": "hlw-uni 小程序运行时 — Vue 组件 + composables + theme + http + 工具集(合并自原 mp-core)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -113,7 +113,6 @@ defineOptions({
113
113
  align-items: center;
114
114
  justify-content: center;
115
115
  color: var(--text-secondary, #475569);
116
- box-shadow: 0 4rpx 16rpx rgba(15, 23, 42, 0.12);
117
116
  }
118
117
 
119
118
  .hlw-back-top--hover {
@@ -425,18 +425,18 @@ defineOptions({
425
425
  /* 浮动触发按钮 */
426
426
  .trigger {
427
427
  position: fixed;
428
- right: 30rpx;
428
+ right: 32rpx;
429
429
  bottom: 40rpx;
430
430
  z-index: 100;
431
431
  width: 66rpx;
432
432
  height: 66rpx;
433
- background: #1e293b;
434
- color: #ffffff;
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: 10rpx;
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,13 +84,13 @@ interface Props {
84
84
  borderColor?: string;
85
85
  /** 边框线型:solid(默认)/ dashed / dotted / double */
86
86
  borderStyle?: "solid" | "dashed" | "dotted" | "double";
87
- /** 边框宽度,CSS 长度值,默认 `1rpx` */
87
+ /** 边框宽度,CSS 长度值,默认 `0.5rpx` */
88
88
  borderWidth?: string;
89
89
  /** 圆角大小,对应 CSS 变量体系 */
90
90
  radius?: "none" | "sm" | "md" | "lg" | "xl";
91
91
  /** 头部与内容之间是否显示虚线分隔,有 #header slot 时默认 true */
92
92
  divider?: boolean;
93
- /** body 是否有内边距,默认 true */
93
+ /** body 是否有内边距,默认 false */
94
94
  padding?: boolean;
95
95
  }
96
96
 
@@ -101,7 +101,7 @@ const props = withDefaults(defineProps<Props>(), {
101
101
  borderWidth: "",
102
102
  radius: "xl",
103
103
  divider: undefined,
104
- padding: true,
104
+ padding: false,
105
105
  });
106
106
 
107
107
  const rootStyle = computed<Record<string, string>>(() => {
@@ -156,6 +156,7 @@ const showDivider = computed(() => {
156
156
  <style lang="scss" scoped>
157
157
  .hlw-card {
158
158
  width: 100%;
159
+ position: relative;
159
160
  background: #fff;
160
161
  overflow: hidden;
161
162
 
@@ -168,36 +169,31 @@ const showDivider = computed(() => {
168
169
 
169
170
  /* 边框 — width / style / color 全部走 CSS 变量,未设置时回落 */
170
171
  &--bordered {
171
- border:
172
- var(--card-border-width, 1rpx)
173
- var(--card-border-style, solid)
174
- var(--card-border-color, var(--border-color, #e2e8f0));
172
+ border-width: var(--card-border-width, 0.5rpx);
173
+ border-style: var(--card-border-style, solid);
174
+ border-color: var(--card-border-color, #e2e8f0);
175
175
  }
176
176
 
177
177
  /* 边框 — 单边 */
178
178
  &--border-top {
179
- border-top:
180
- var(--card-border-width, 1rpx)
181
- var(--card-border-style, solid)
182
- var(--card-border-color, var(--border-color, #e2e8f0));
179
+ border-top-width: var(--card-border-width, 0.5rpx);
180
+ border-top-style: var(--card-border-style, solid);
181
+ border-top-color: var(--card-border-color, #e2e8f0);
183
182
  }
184
183
  &--border-right {
185
- border-right:
186
- var(--card-border-width, 1rpx)
187
- var(--card-border-style, solid)
188
- var(--card-border-color, var(--border-color, #e2e8f0));
184
+ border-right-width: var(--card-border-width, 0.5rpx);
185
+ border-right-style: var(--card-border-style, solid);
186
+ border-right-color: var(--card-border-color, #e2e8f0);
189
187
  }
190
188
  &--border-bottom {
191
- border-bottom:
192
- var(--card-border-width, 1rpx)
193
- var(--card-border-style, solid)
194
- var(--card-border-color, var(--border-color, #e2e8f0));
189
+ border-bottom-width: var(--card-border-width, 0.5rpx);
190
+ border-bottom-style: var(--card-border-style, solid);
191
+ border-bottom-color: var(--card-border-color, #e2e8f0);
195
192
  }
196
193
  &--border-left {
197
- border-left:
198
- var(--card-border-width, 1rpx)
199
- var(--card-border-style, solid)
200
- var(--card-border-color, var(--border-color, #e2e8f0));
194
+ border-left-width: var(--card-border-width, 0.5rpx);
195
+ border-left-style: var(--card-border-style, solid);
196
+ border-left-color: var(--card-border-color, #e2e8f0);
201
197
  }
202
198
  }
203
199
 
@@ -1,16 +1,20 @@
1
1
  <template>
2
- <view class="hlw-card-header" :class="{ 'hlw-card-header--divider': divider }">
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="extra" class="hlw-card-header__extra">{{ extra }}</text>
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" extra="副标题" />
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" extra="副标题" />
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
- /** 右侧附加文字(无 right slot 时显示) */
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 hasRight = computed(() => !!(slots.right || props.extra));
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,12 +141,9 @@ defineOptions({
97
141
  display: flex;
98
142
  align-items: center;
99
143
  justify-content: space-between;
100
- padding: 32rpx 24rpx;
144
+ padding: 26rpx 26rpx;
101
145
  box-sizing: border-box;
102
146
 
103
- &--divider {
104
- border-bottom: var(--card-header-divider-width, 1rpx) var(--card-header-divider-style, dashed) var(--card-header-divider-color, var(--border-color, #e2e8f0));
105
- }
106
147
  }
107
148
 
108
149
  .hlw-card-header__left {
@@ -165,22 +206,22 @@ defineOptions({
165
206
  }
166
207
 
167
208
  .hlw-card-header__icon {
168
- font-size: 20rpx;
209
+ font-size: var(--font-xs);
169
210
  }
170
211
 
171
212
  .hlw-card-header__title {
172
- font-size: 30rpx;
213
+ font-size: var(--font-base);
173
214
  font-weight: 500;
174
215
  color: var(--text-primary, #1e293b);
175
216
  letter-spacing: 1rpx;
176
217
  }
177
218
 
178
- .hlw-card-header__extra {
219
+ .hlw-card-header__desc {
179
220
  padding: 4rpx 16rpx;
180
221
  border-radius: var(--radius-sm, 8rpx);
181
222
  background: rgba(241, 245, 249, 0.8);
182
223
  color: var(--text-muted, #64748b);
183
- font-size: 20rpx;
224
+ font-size: var(--font-xs);
184
225
  font-weight: 400;
185
226
  }
186
227
  </style>