@hlw-uni/mp-vue 2.3.9 → 2.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hlw-uni/mp-vue",
3
- "version": "2.3.9",
3
+ "version": "2.5.1",
4
4
  "description": "hlw-uni工具集",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -86,12 +86,12 @@ const initial = computed(() => {
86
86
  }
87
87
 
88
88
  .hlw-avatar--small .hlw-avatar__initial {
89
- font-size: var(--font-xs, 20rpx);
89
+ font-size: var(--font-xs, 22rpx);
90
90
  }
91
91
  .hlw-avatar--medium .hlw-avatar__initial {
92
- font-size: var(--font-base, 28rpx);
92
+ font-size: var(--font-base, 30rpx);
93
93
  }
94
94
  .hlw-avatar--large .hlw-avatar__initial {
95
- font-size: var(--font-xl, 40rpx);
95
+ font-size: var(--font-xl, 42rpx);
96
96
  }
97
97
  </style>
@@ -209,21 +209,21 @@ $semantic-colors: (
209
209
  &--small {
210
210
  min-height: 56rpx;
211
211
  padding: 12rpx 20rpx;
212
- font-size: var(--font-xs, 20rpx);
212
+ font-size: var(--font-xs, 22rpx);
213
213
  border-radius: var(--radius-sm, 8rpx);
214
214
  }
215
215
 
216
216
  &--medium {
217
217
  min-height: 72rpx;
218
218
  padding: 18rpx 32rpx;
219
- font-size: var(--font-sm, 24rpx);
219
+ font-size: var(--font-sm, 26rpx);
220
220
  border-radius: var(--radius-md, 16rpx);
221
221
  }
222
222
 
223
223
  &--large {
224
224
  min-height: 88rpx;
225
225
  padding: 22rpx 48rpx;
226
- font-size: var(--font-base, 28rpx);
226
+ font-size: var(--font-base, 30rpx);
227
227
  border-radius: var(--radius-md, 16rpx);
228
228
  }
229
229
 
@@ -164,7 +164,7 @@ const showDivider = computed(() => {
164
164
  &--radius-none { border-radius: 0; }
165
165
  &--radius-sm { border-radius: var(--radius-sm, 8rpx); }
166
166
  &--radius-md { border-radius: var(--radius-md, 16rpx); }
167
- &--radius-lg { border-radius: var(--radius-lg, 24rpx); }
167
+ &--radius-lg { border-radius: var(--radius-lg, 30rpx); }
168
168
  &--radius-xl { border-radius: var(--radius-xl, 32rpx); }
169
169
 
170
170
  /* 边框 — width / style / color 全部走 CSS 变量,未设置时回落 */
@@ -102,13 +102,13 @@ defineEmits<{ click: [] }>();
102
102
  }
103
103
 
104
104
  .hlw-cell-icon {
105
- font-size: var(--font-lg, 36rpx);
105
+ font-size: var(--font-lg, 38rpx);
106
106
  color: var(--primary-color, #3b82f6);
107
107
  flex-shrink: 0;
108
108
 
109
109
  view {
110
- width: var(--font-lg, 36rpx);
111
- height: var(--font-lg, 36rpx);
110
+ width: var(--font-lg, 38rpx);
111
+ height: var(--font-lg, 38rpx);
112
112
  display: inline-block;
113
113
  }
114
114
  }
@@ -122,18 +122,18 @@ defineEmits<{ click: [] }>();
122
122
  }
123
123
 
124
124
  .hlw-cell-title {
125
- font-size: var(--font-base, 28rpx);
125
+ font-size: var(--font-base, 30rpx);
126
126
  color: #1e293b;
127
127
  }
128
128
 
129
129
  .hlw-cell-label {
130
- font-size: var(--font-xs, 20rpx);
130
+ font-size: var(--font-xs, 22rpx);
131
131
  color: #94a3b8;
132
132
  margin-top: 4rpx;
133
133
  }
134
134
 
135
135
  .hlw-cell-value {
136
- font-size: var(--font-sm, 24rpx);
136
+ font-size: var(--font-sm, 26rpx);
137
137
  color: #94a3b8;
138
138
  flex-shrink: 0;
139
139
  }
@@ -50,7 +50,7 @@ defineProps<{
50
50
  }
51
51
 
52
52
  .hlw-empty__text {
53
- font-size: var(--font-base, 28rpx);
53
+ font-size: var(--font-base, 30rpx);
54
54
  color: #bbb;
55
55
  }
56
56
  </style>
@@ -206,12 +206,12 @@ const handleGetPhoneNumber = (item: HlwMenuItem, event: unknown) => {
206
206
 
207
207
  <style lang="scss" scoped>
208
208
  .hlw-menu {
209
- --hlw-menu-icon-size: var(--font-md, 32rpx);
209
+ --hlw-menu-icon-size: var(--font-md, 34rpx);
210
210
  --hlw-menu-icon-box-size: var(--hlw-menu-icon-size);
211
- --hlw-menu-grid-icon-size: var(--font-xl, 40rpx);
211
+ --hlw-menu-grid-icon-size: var(--font-xl, 42rpx);
212
212
  --hlw-menu-grid-icon-box-size: calc(var(--hlw-menu-grid-icon-size) + 52rpx);
213
213
  background: var(--surface-card, #ffffff);
214
- border-radius: var(--radius-lg, 24rpx);
214
+ border-radius: var(--radius-lg, 30rpx);
215
215
  border: 1rpx solid var(--border-color-light, #ececec);
216
216
  overflow: hidden;
217
217
  width: 100%;
@@ -225,7 +225,7 @@ const handleGetPhoneNumber = (item: HlwMenuItem, event: unknown) => {
225
225
  .hlw-menu-title {
226
226
  padding: 24rpx 32rpx;
227
227
  text {
228
- font-size: var(--font-sm, 24rpx);
228
+ font-size: var(--font-sm, 26rpx);
229
229
  font-weight: 600;
230
230
  color: var(--text-subtle, #94a3b8);
231
231
  letter-spacing: 1rpx;
@@ -318,7 +318,7 @@ const handleGetPhoneNumber = (item: HlwMenuItem, event: unknown) => {
318
318
  position: absolute;
319
319
  top: 0;
320
320
  right: -8rpx;
321
- font-size: var(--font-xs, 20rpx);
321
+ font-size: var(--font-xs, 22rpx);
322
322
  color: #fff;
323
323
  padding: 0 8rpx;
324
324
  border-radius: 9999rpx;
@@ -329,7 +329,7 @@ const handleGetPhoneNumber = (item: HlwMenuItem, event: unknown) => {
329
329
  }
330
330
 
331
331
  .hlw-menu-grid-label {
332
- font-size: var(--font-sm, 24rpx);
332
+ font-size: var(--font-sm, 26rpx);
333
333
  color: var(--text-secondary, #334155);
334
334
  text-align: center;
335
335
  }
@@ -402,12 +402,12 @@ const handleGetPhoneNumber = (item: HlwMenuItem, event: unknown) => {
402
402
  }
403
403
 
404
404
  .hlw-menu-value {
405
- font-size: var(--font-sm, 24rpx);
405
+ font-size: var(--font-sm, 26rpx);
406
406
  color: var(--text-subtle, #94a3b8);
407
407
  }
408
408
 
409
409
  .hlw-menu-tag {
410
- font-size: var(--font-xs, 20rpx);
410
+ font-size: var(--font-xs, 22rpx);
411
411
  color: #fff;
412
412
  padding: 2rpx 12rpx;
413
413
  border-radius: 9999rpx;
@@ -446,14 +446,14 @@ const handleGetPhoneNumber = (item: HlwMenuItem, event: unknown) => {
446
446
 
447
447
  .hlw-menu-arrow {
448
448
  color: var(--text-disabled, #d1d5db);
449
- font-size: var(--font-sm, 24rpx);
449
+ font-size: var(--font-sm, 26rpx);
450
450
  }
451
451
  .hlw-menu-spin {
452
452
  animation: icon-spin 1s linear infinite;
453
453
  }
454
454
  .hlw-menu-muted {
455
455
  color: var(--text-subtle, #94a3b8);
456
- font-size: var(--font-sm, 24rpx);
456
+ font-size: var(--font-sm, 26rpx);
457
457
  }
458
458
 
459
459
  @keyframes icon-spin {
@@ -91,13 +91,13 @@ function onCancel() {
91
91
  .hlw-modal-title {
92
92
  padding: 40rpx 32rpx 0;
93
93
  text-align: center;
94
- font-size: var(--font-md, 32rpx);
94
+ font-size: var(--font-md, 34rpx);
95
95
  font-weight: 600;
96
96
  color: var(--text-primary, #1e293b);
97
97
  }
98
98
 
99
99
  .hlw-modal-body {
100
- font-size: var(--font-base, 28rpx);
100
+ font-size: var(--font-base, 30rpx);
101
101
  color: var(--text-secondary, #475569);
102
102
  text-align: center;
103
103
  line-height: 1.6;
@@ -112,7 +112,7 @@ function onCancel() {
112
112
  flex: 1;
113
113
  padding: 24rpx 0;
114
114
  text-align: center;
115
- font-size: var(--font-base, 28rpx);
115
+ font-size: var(--font-base, 30rpx);
116
116
  font-weight: 500;
117
117
 
118
118
  &:active { background: var(--surface-card-muted, #f8fafc); }
@@ -161,7 +161,7 @@ function tapBack() {
161
161
  }
162
162
 
163
163
  .title {
164
- font-size: var(--navbar-font-size, var(--font-md, 32rpx));
164
+ font-size: var(--navbar-font-size, var(--font-md, 34rpx));
165
165
  font-family: var(--navbar-font-family, inherit);
166
166
  letter-spacing: 3rpx;
167
167
  font-weight: 500;
@@ -111,7 +111,7 @@ function confirmNickname() {
111
111
  .nickname-dialog {
112
112
  width: 600rpx;
113
113
  padding: 40rpx;
114
- border-radius: 24rpx;
114
+ border-radius: var(--radius-lg, 30rpx);
115
115
  background: #ffffff;
116
116
  box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.25);
117
117
  animation: scaleIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
@@ -121,7 +121,7 @@ function confirmNickname() {
121
121
  margin-bottom: 30rpx;
122
122
  color: #1e293b;
123
123
  text-align: center;
124
- font-size: 32rpx;
124
+ font-size: var(--font-md, 34rpx);
125
125
  font-weight: 600;
126
126
  letter-spacing: 1rpx;
127
127
  }
@@ -130,7 +130,7 @@ function confirmNickname() {
130
130
  margin-bottom: 40rpx;
131
131
  padding: 20rpx 24rpx;
132
132
  border: 2rpx solid #e2e8f0;
133
- border-radius: 16rpx;
133
+ border-radius: var(--radius-md, 16rpx);
134
134
  background: #f8fafc;
135
135
  }
136
136
 
@@ -138,7 +138,7 @@ function confirmNickname() {
138
138
  width: 100%;
139
139
  height: 48rpx;
140
140
  color: #1e293b;
141
- font-size: 28rpx;
141
+ font-size: var(--font-base, 30rpx);
142
142
  text-align: left;
143
143
  }
144
144
 
@@ -154,9 +154,9 @@ function confirmNickname() {
154
154
  justify-content: center;
155
155
  height: 80rpx;
156
156
  margin: 0;
157
- font-size: 28rpx;
157
+ font-size: var(--font-base, 30rpx);
158
158
  font-weight: 500;
159
- border-radius: 16rpx;
159
+ border-radius: var(--radius-md, 16rpx);
160
160
  }
161
161
 
162
162
  .dialog-btn::after {
@@ -75,12 +75,12 @@ function onClose() {
75
75
  align-items: center;
76
76
  padding: 16rpx 24rpx;
77
77
  gap: 12rpx;
78
- font-size: var(--font-sm, 24rpx);
78
+ font-size: var(--font-sm, 26rpx);
79
79
  }
80
80
 
81
81
  .hlw-notice-left-icon {
82
82
  flex-shrink: 0;
83
- font-size: var(--font-base, 28rpx);
83
+ font-size: var(--font-base, 30rpx);
84
84
  }
85
85
 
86
86
  .hlw-notice-wrap {
@@ -109,7 +109,7 @@ function onClose() {
109
109
 
110
110
  .hlw-notice-close {
111
111
  flex-shrink: 0;
112
- font-size: 28rpx;
112
+ font-size: var(--font-base, 30rpx);
113
113
  line-height: 1;
114
114
  opacity: 0.6;
115
115
  padding: 4rpx;
@@ -213,7 +213,7 @@ function onCancel() {
213
213
 
214
214
  .hlw-notice-btn-text {
215
215
  color: #ffffff;
216
- font-size: var(--font-base, 28rpx);
216
+ font-size: var(--font-base, 30rpx);
217
217
  font-weight: 600;
218
218
  letter-spacing: 1rpx;
219
219
  }
@@ -231,7 +231,7 @@ function onCancel() {
231
231
  }
232
232
 
233
233
  .hlw-notice-dismiss-text {
234
- font-size: var(--font-xs, 24rpx);
234
+ font-size: var(--font-xs, 26rpx);
235
235
  color: var(--text-muted, #8e8e93);
236
236
  font-weight: 500;
237
237
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view :class="[fontSizeClass, fontFamilyClass]" :style="pageStyle">
2
+ <view class="hlw-page-container" :class="[fontSizeClass, fontFamilyClass]" :style="pageStyle">
3
3
  <hlw-nav-bar v-if="props.isNav"
4
4
  :is-back="props.isBack"
5
5
  :title="title"
@@ -10,8 +10,29 @@
10
10
  :title-weight="props.titleWeight"
11
11
  :border="props.border">
12
12
  </hlw-nav-bar>
13
- <slot></slot>
14
- <view class="h-[60rpx]"></view>
13
+
14
+ <!-- 上插槽 -->
15
+ <view class="hlw-page-top">
16
+ <slot name="top"></slot>
17
+ </view>
18
+
19
+ <!-- 内容插槽 scroll-view -->
20
+ <scroll-view
21
+ class="hlw-page-content"
22
+ scroll-y
23
+ :refresher-enabled="props.refresherEnabled"
24
+ :refresher-triggered="props.refresherTriggered"
25
+ @refresherrefresh="onRefresh"
26
+ @scrolltolower="onScrollToLower"
27
+ >
28
+ <slot></slot>
29
+ <view class="h-[60rpx]"></view>
30
+ </scroll-view>
31
+
32
+ <!-- 下插槽 -->
33
+ <view class="hlw-page-bottom">
34
+ <slot name="bottom"></slot>
35
+ </view>
15
36
  </view>
16
37
  </template>
17
38
 
@@ -32,16 +53,25 @@
32
53
  * titleStyle - 标题字体样式
33
54
  * titleWeight - 标题字重
34
55
  * border - 是否显示自定义导航栏的下边框(下划线),默认 true
56
+ * refresherEnabled - 是否开启下拉刷新,默认 false
57
+ * refresherTriggered - 设置当前下拉刷新状态,true 表示下拉刷新已被触发,false 表示下拉刷新未被触发
35
58
  *
36
59
  * @example
37
60
  * ```vue
38
61
  * <hlw-page is-nav is-back title="个人中心">
39
- * <view>页面内容...</view>
62
+ * <template #top>
63
+ * <view>固定在顶部的内容...</view>
64
+ * </template>
65
+ * <view>滚动的内容...</view>
66
+ * <template #bottom>
67
+ * <view>固定在底部的内容...</view>
68
+ * </template>
40
69
  * </hlw-page>
41
70
  * ```
42
71
  */
43
72
  import { useTheme } from "@/core";
44
73
  import { ref, computed } from "vue";
74
+
45
75
  const { fontSizeClass, fontFamilyClass } = useTheme();
46
76
 
47
77
  const props = defineProps({
@@ -80,9 +110,19 @@ const props = defineProps({
80
110
  border: {
81
111
  type: Boolean,
82
112
  default: true,
113
+ },
114
+ refresherEnabled: {
115
+ type: Boolean,
116
+ default: false,
117
+ },
118
+ refresherTriggered: {
119
+ type: Boolean,
120
+ default: false,
83
121
  }
84
122
  });
85
123
 
124
+ const emit = defineEmits(["refresh", "scrolltolower"]);
125
+
86
126
  const title = ref(props.title);
87
127
 
88
128
  const navbarHeight = computed(() => {
@@ -105,44 +145,75 @@ const pageStyle = computed(() => {
105
145
  "--navbar-height": `${navbarHeight.value}px`,
106
146
  };
107
147
  });
148
+
149
+ function onRefresh() {
150
+ emit("refresh");
151
+ }
152
+
153
+ function onScrollToLower() {
154
+ emit("scrolltolower");
155
+ }
108
156
  </script>
109
157
 
110
158
  <style lang="scss">
159
+ .hlw-page-container {
160
+ height: 100vh;
161
+ display: flex;
162
+ flex-direction: column;
163
+ overflow: hidden;
164
+ box-sizing: border-box;
165
+ }
166
+
167
+ .hlw-page-top {
168
+ flex-shrink: 0;
169
+ }
170
+
171
+ .hlw-page-content {
172
+ flex: 1;
173
+ height: 0;
174
+ min-height: 0;
175
+ width: 100%;
176
+ }
177
+
178
+ .hlw-page-bottom {
179
+ flex-shrink: 0;
180
+ }
181
+
111
182
  /* 全局系统字体大小缩放配置 */
112
183
  .font-size-small {
113
- --font-xs: 18rpx;
114
- --font-sm: 22rpx;
115
- --font-base: 24rpx;
116
- --font-md: 28rpx;
117
- --font-lg: 32rpx;
118
- --font-xl: 36rpx;
184
+ --font-xs: 20rpx;
185
+ --font-sm: 24rpx;
186
+ --font-base: 26rpx;
187
+ --font-md: 30rpx;
188
+ --font-lg: 34rpx;
189
+ --font-xl: 38rpx;
119
190
  }
120
191
 
121
192
  .font-size-standard {
122
- --font-xs: 20rpx;
123
- --font-sm: 24rpx;
124
- --font-base: 28rpx;
125
- --font-md: 32rpx;
126
- --font-lg: 36rpx;
127
- --font-xl: 40rpx;
193
+ --font-xs: 22rpx;
194
+ --font-sm: 26rpx;
195
+ --font-base: 30rpx;
196
+ --font-md: 34rpx;
197
+ --font-lg: 38rpx;
198
+ --font-xl: 42rpx;
128
199
  }
129
200
 
130
201
  .font-size-large {
131
- --font-xs: 22rpx;
132
- --font-sm: 28rpx;
133
- --font-base: 32rpx;
134
- --font-md: 36rpx;
135
- --font-lg: 40rpx;
136
- --font-xl: 44rpx;
202
+ --font-xs: 24rpx;
203
+ --font-sm: 30rpx;
204
+ --font-base: 34rpx;
205
+ --font-md: 38rpx;
206
+ --font-lg: 42rpx;
207
+ --font-xl: 46rpx;
137
208
  }
138
209
 
139
210
  .font-size-extra-large {
140
- --font-xs: 24rpx;
141
- --font-sm: 32rpx;
142
- --font-base: 36rpx;
143
- --font-md: 40rpx;
144
- --font-lg: 44rpx;
145
- --font-xl: 48rpx;
211
+ --font-xs: 26rpx;
212
+ --font-sm: 34rpx;
213
+ --font-base: 38rpx;
214
+ --font-md: 42rpx;
215
+ --font-lg: 46rpx;
216
+ --font-xl: 50rpx;
146
217
  }
147
218
 
148
219
  /* 全局字体样式配置 */
@@ -120,13 +120,13 @@ function onClose() {
120
120
  }
121
121
 
122
122
  .hlw-popup-title {
123
- font-size: var(--font-md, 32rpx);
123
+ font-size: var(--font-md, 34rpx);
124
124
  font-weight: 600;
125
125
  color: #1e293b;
126
126
  }
127
127
 
128
128
  .hlw-popup-close {
129
- font-size: 32rpx;
129
+ font-size: var(--font-md, 34rpx);
130
130
  color: #94a3b8;
131
131
  line-height: 1;
132
132
  padding: 4rpx;
@@ -98,20 +98,20 @@ function onClear() {
98
98
  }
99
99
 
100
100
  .hlw-search-icon {
101
- font-size: var(--font-sm, 24rpx);
101
+ font-size: var(--font-sm, 26rpx);
102
102
  flex-shrink: 0;
103
103
  opacity: 0.5;
104
104
  }
105
105
 
106
106
  .hlw-search-input {
107
107
  flex: 1;
108
- font-size: var(--font-sm, 24rpx);
108
+ font-size: var(--font-sm, 26rpx);
109
109
  color: #1e293b;
110
110
  min-height: 40rpx;
111
111
  }
112
112
 
113
113
  .hlw-search-clear {
114
- font-size: 28rpx;
114
+ font-size: var(--font-base, 30rpx);
115
115
  color: #94a3b8;
116
116
  line-height: 1;
117
117
  flex-shrink: 0;
@@ -211,7 +211,7 @@ onBeforeUnmount(() => {
211
211
  }
212
212
 
213
213
  .hlw-sheet-title {
214
- font-size: var(--font-md, 32rpx);
214
+ font-size: var(--font-md, 34rpx);
215
215
  font-weight: 700;
216
216
  color: var(--text-primary, #0f172a);
217
217
  }
@@ -228,7 +228,7 @@ onBeforeUnmount(() => {
228
228
  display: flex;
229
229
  align-items: center;
230
230
  justify-content: center;
231
- font-size: var(--font-sm, 24rpx);
231
+ font-size: var(--font-sm, 26rpx);
232
232
  transition: background 0.2s ease;
233
233
 
234
234
  &:active {
@@ -265,7 +265,7 @@ onBeforeUnmount(() => {
265
265
  }
266
266
 
267
267
  .hlw-sheet-cta-text {
268
- font-size: var(--font-sm, 24rpx);
268
+ font-size: var(--font-sm, 26rpx);
269
269
  font-weight: 400;
270
270
  color: #ffffff;
271
271
  letter-spacing: 0.5rpx;
@@ -118,7 +118,7 @@ function onChange(index: number) {
118
118
  }
119
119
 
120
120
  .hlw-tab-text {
121
- font-size: var(--font-base, 28rpx);
121
+ font-size: var(--font-base, 30rpx);
122
122
  color: #64748b;
123
123
  transition: color 0.2s;
124
124
  }
@@ -87,7 +87,7 @@ $colors: (
87
87
  &--medium {
88
88
  min-height: 36rpx;
89
89
  padding: 4rpx 16rpx;
90
- font-size: var(--font-xs, 20rpx);
90
+ font-size: var(--font-xs, 22rpx);
91
91
  border-radius: var(--radius-sm, 8rpx);
92
92
  }
93
93