@hlw-uni/mp-vue 2.1.32 → 2.1.34

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.32",
3
+ "version": "2.1.34",
4
4
  "description": "hlw-uni 小程序运行时 — Vue 组件 + composables + theme + http + 工具集(合并自原 mp-core)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -90,7 +90,7 @@ interface Props {
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, 1rpx);
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, 1rpx);
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, 1rpx);
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, 1rpx);
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, 1rpx);
195
+ border-left-style: var(--card-border-style, solid);
196
+ border-left-color: var(--card-border-color, #e2e8f0);
201
197
  }
202
198
  }
203
199
 
@@ -2,7 +2,7 @@
2
2
  <view class="hlw-card-header" :class="{ 'hlw-card-header--divider': divider }">
3
3
  <view class="hlw-card-header__left">
4
4
  <slot name="left">
5
- <view v-if="icon" class="hlw-card-header__icon-box">
5
+ <view v-if="icon" class="hlw-card-header__icon-box" :class="iconBoxClass">
6
6
  <text class="hlw-card-header__icon" :class="icon" />
7
7
  </view>
8
8
  <text v-if="title" class="hlw-card-header__title">{{ title }}</text>
@@ -71,6 +71,21 @@ const slots = useSlots();
71
71
 
72
72
  const hasRight = computed(() => !!(slots.right || props.extra));
73
73
 
74
+ const iconToneClass = computed(() => {
75
+ const value = props.icon;
76
+ if (value.includes("text-rose") || value.includes("text-red")) return "rose";
77
+ if (value.includes("text-emerald") || value.includes("text-green")) return "emerald";
78
+ if (value.includes("text-blue")) return "blue";
79
+ if (value.includes("text-sky")) return "sky";
80
+ if (value.includes("text-cyan")) return "cyan";
81
+ if (value.includes("text-purple")) return "purple";
82
+ if (value.includes("text-pink")) return "pink";
83
+ if (value.includes("text-yellow") || value.includes("text-amber")) return "amber";
84
+ return "indigo";
85
+ });
86
+
87
+ const iconBoxClass = computed(() => `hlw-card-header__icon-box--${iconToneClass.value}`);
88
+
74
89
  defineOptions({
75
90
  name: "HlwCardHeader",
76
91
  });
@@ -85,9 +100,6 @@ defineOptions({
85
100
  padding: 32rpx 24rpx;
86
101
  box-sizing: border-box;
87
102
 
88
- &--divider {
89
- border-bottom: var(--card-header-divider-width, 1rpx) var(--card-header-divider-style, dashed) var(--card-header-divider-color, var(--border-color, #e2e8f0));
90
- }
91
103
  }
92
104
 
93
105
  .hlw-card-header__left {
@@ -108,15 +120,49 @@ defineOptions({
108
120
  width: 56rpx;
109
121
  height: 56rpx;
110
122
  border-radius: var(--radius-md, 16rpx);
111
- background: #eef2ff;
112
- color: #6366f1;
113
123
  display: flex;
114
124
  align-items: center;
115
125
  justify-content: center;
126
+
127
+ &--indigo {
128
+ background: #eef2ff;
129
+ }
130
+
131
+ &--rose {
132
+ background: #fff1f2;
133
+ }
134
+
135
+ &--emerald {
136
+ background: #ecfdf5;
137
+ }
138
+
139
+ &--blue {
140
+ background: #eff6ff;
141
+ }
142
+
143
+ &--sky {
144
+ background: #f0f9ff;
145
+ }
146
+
147
+ &--cyan {
148
+ background: #ecfeff;
149
+ }
150
+
151
+ &--purple {
152
+ background: #faf5ff;
153
+ }
154
+
155
+ &--pink {
156
+ background: #fdf2f8;
157
+ }
158
+
159
+ &--amber {
160
+ background: #fffbeb;
161
+ }
116
162
  }
117
163
 
118
164
  .hlw-card-header__icon {
119
- font-size: 22rpx;
165
+ font-size: 20rpx;
120
166
  }
121
167
 
122
168
  .hlw-card-header__title {