@hlw-uni/mp-vue 1.0.8 → 1.0.10
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/dist/index.js +37 -11
- package/dist/index.mjs +37 -11
- package/dist/style.css +22 -16
- package/package.json +1 -1
- package/src/components/hlw-header/index.vue +56 -18
- package/src/env.d.ts +5 -0
package/dist/index.js
CHANGED
|
@@ -169,10 +169,13 @@
|
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
171
|
const index$4 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-72364322"]]);
|
|
172
|
-
const _hoisted_1$3 = {
|
|
172
|
+
const _hoisted_1$3 = {
|
|
173
|
+
key: 0,
|
|
174
|
+
class: "header-placeholder"
|
|
175
|
+
};
|
|
173
176
|
const _hoisted_2$3 = {
|
|
174
177
|
key: 0,
|
|
175
|
-
class: "header-title"
|
|
178
|
+
class: "header-title header-title--center"
|
|
176
179
|
};
|
|
177
180
|
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
178
181
|
__name: "index",
|
|
@@ -180,7 +183,11 @@
|
|
|
180
183
|
extraHeight: { default: 0 },
|
|
181
184
|
bgClass: { default: "" },
|
|
182
185
|
isBack: { type: Boolean, default: false },
|
|
183
|
-
title: { default: "" }
|
|
186
|
+
title: { default: "" },
|
|
187
|
+
titleAlign: { default: "center" },
|
|
188
|
+
titleSize: { default: "26rpx" },
|
|
189
|
+
titleWeight: { default: 500 },
|
|
190
|
+
titleColor: { default: "" }
|
|
184
191
|
},
|
|
185
192
|
emits: ["back"],
|
|
186
193
|
setup(__props, { emit: __emit }) {
|
|
@@ -211,6 +218,11 @@
|
|
|
211
218
|
emit("back");
|
|
212
219
|
uni.navigateBack({ delta: 1 });
|
|
213
220
|
};
|
|
221
|
+
const titleStyle = vue.computed(() => ({
|
|
222
|
+
fontSize: props.titleSize,
|
|
223
|
+
fontWeight: String(props.titleWeight),
|
|
224
|
+
...props.titleColor ? { color: props.titleColor } : {}
|
|
225
|
+
}));
|
|
214
226
|
const slots = vue.useSlots();
|
|
215
227
|
const hasBgSlot = vue.computed(() => !props.isBack && !!slots.bg);
|
|
216
228
|
const statusBarHeight = vue.ref(getStatusBarHeight());
|
|
@@ -237,22 +249,36 @@
|
|
|
237
249
|
vue.createElementVNode("view", {
|
|
238
250
|
class: "header-back",
|
|
239
251
|
onClick: handleBack
|
|
240
|
-
}, [
|
|
241
|
-
vue.
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
vue.createElementVNode("text", null, vue.toDisplayString(props.title), 1)
|
|
252
|
+
}, [
|
|
253
|
+
vue.renderSlot(_ctx.$slots, "back-icon", {}, () => [
|
|
254
|
+
_cache[0] || (_cache[0] = vue.createElementVNode("text", { class: "i-fa6-solid-chevron-left header-back-icon" }, null, -1))
|
|
255
|
+
], true)
|
|
245
256
|
]),
|
|
246
|
-
|
|
257
|
+
vue.createElementVNode("view", {
|
|
258
|
+
class: vue.normalizeClass(["header-title", props.titleAlign === "left" ? "header-title--left" : "header-title--center"])
|
|
259
|
+
}, [
|
|
260
|
+
vue.renderSlot(_ctx.$slots, "title", {}, () => [
|
|
261
|
+
vue.createElementVNode("text", {
|
|
262
|
+
class: "header-title-text",
|
|
263
|
+
style: vue.normalizeStyle(titleStyle.value)
|
|
264
|
+
}, vue.toDisplayString(props.title), 5)
|
|
265
|
+
], true)
|
|
266
|
+
], 2),
|
|
267
|
+
props.titleAlign === "center" ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_1$3)) : vue.createCommentVNode("", true)
|
|
247
268
|
], 64)) : vue.renderSlot(_ctx.$slots, "default", { key: 1 }, () => [
|
|
248
|
-
props.title ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_2$3,
|
|
269
|
+
props.title ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_2$3, [
|
|
270
|
+
vue.createElementVNode("text", {
|
|
271
|
+
class: "header-title-text",
|
|
272
|
+
style: vue.normalizeStyle(titleStyle.value)
|
|
273
|
+
}, vue.toDisplayString(props.title), 5)
|
|
274
|
+
])) : vue.createCommentVNode("", true)
|
|
249
275
|
], true)
|
|
250
276
|
], 4)
|
|
251
277
|
], 4);
|
|
252
278
|
};
|
|
253
279
|
}
|
|
254
280
|
});
|
|
255
|
-
const index$3 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
281
|
+
const index$3 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-9a6c839c"]]);
|
|
256
282
|
const _hoisted_1$2 = { class: "hlw-loading" };
|
|
257
283
|
const _hoisted_2$2 = {
|
|
258
284
|
key: 0,
|
package/dist/index.mjs
CHANGED
|
@@ -166,10 +166,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
168
|
const index$4 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-72364322"]]);
|
|
169
|
-
const _hoisted_1$3 = {
|
|
169
|
+
const _hoisted_1$3 = {
|
|
170
|
+
key: 0,
|
|
171
|
+
class: "header-placeholder"
|
|
172
|
+
};
|
|
170
173
|
const _hoisted_2$3 = {
|
|
171
174
|
key: 0,
|
|
172
|
-
class: "header-title"
|
|
175
|
+
class: "header-title header-title--center"
|
|
173
176
|
};
|
|
174
177
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
175
178
|
__name: "index",
|
|
@@ -177,7 +180,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
177
180
|
extraHeight: { default: 0 },
|
|
178
181
|
bgClass: { default: "" },
|
|
179
182
|
isBack: { type: Boolean, default: false },
|
|
180
|
-
title: { default: "" }
|
|
183
|
+
title: { default: "" },
|
|
184
|
+
titleAlign: { default: "center" },
|
|
185
|
+
titleSize: { default: "26rpx" },
|
|
186
|
+
titleWeight: { default: 500 },
|
|
187
|
+
titleColor: { default: "" }
|
|
181
188
|
},
|
|
182
189
|
emits: ["back"],
|
|
183
190
|
setup(__props, { emit: __emit }) {
|
|
@@ -208,6 +215,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
208
215
|
emit("back");
|
|
209
216
|
uni.navigateBack({ delta: 1 });
|
|
210
217
|
};
|
|
218
|
+
const titleStyle = computed(() => ({
|
|
219
|
+
fontSize: props.titleSize,
|
|
220
|
+
fontWeight: String(props.titleWeight),
|
|
221
|
+
...props.titleColor ? { color: props.titleColor } : {}
|
|
222
|
+
}));
|
|
211
223
|
const slots = useSlots();
|
|
212
224
|
const hasBgSlot = computed(() => !props.isBack && !!slots.bg);
|
|
213
225
|
const statusBarHeight = ref(getStatusBarHeight());
|
|
@@ -234,22 +246,36 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
234
246
|
createElementVNode("view", {
|
|
235
247
|
class: "header-back",
|
|
236
248
|
onClick: handleBack
|
|
237
|
-
}, [
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
createElementVNode("text", null, toDisplayString(props.title), 1)
|
|
249
|
+
}, [
|
|
250
|
+
renderSlot(_ctx.$slots, "back-icon", {}, () => [
|
|
251
|
+
_cache[0] || (_cache[0] = createElementVNode("text", { class: "i-fa6-solid-chevron-left header-back-icon" }, null, -1))
|
|
252
|
+
], true)
|
|
242
253
|
]),
|
|
243
|
-
|
|
254
|
+
createElementVNode("view", {
|
|
255
|
+
class: normalizeClass(["header-title", props.titleAlign === "left" ? "header-title--left" : "header-title--center"])
|
|
256
|
+
}, [
|
|
257
|
+
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
258
|
+
createElementVNode("text", {
|
|
259
|
+
class: "header-title-text",
|
|
260
|
+
style: normalizeStyle(titleStyle.value)
|
|
261
|
+
}, toDisplayString(props.title), 5)
|
|
262
|
+
], true)
|
|
263
|
+
], 2),
|
|
264
|
+
props.titleAlign === "center" ? (openBlock(), createElementBlock("view", _hoisted_1$3)) : createCommentVNode("", true)
|
|
244
265
|
], 64)) : renderSlot(_ctx.$slots, "default", { key: 1 }, () => [
|
|
245
|
-
props.title ? (openBlock(), createElementBlock("view", _hoisted_2$3,
|
|
266
|
+
props.title ? (openBlock(), createElementBlock("view", _hoisted_2$3, [
|
|
267
|
+
createElementVNode("text", {
|
|
268
|
+
class: "header-title-text",
|
|
269
|
+
style: normalizeStyle(titleStyle.value)
|
|
270
|
+
}, toDisplayString(props.title), 5)
|
|
271
|
+
])) : createCommentVNode("", true)
|
|
246
272
|
], true)
|
|
247
273
|
], 4)
|
|
248
274
|
], 4);
|
|
249
275
|
};
|
|
250
276
|
}
|
|
251
277
|
});
|
|
252
|
-
const index$3 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
278
|
+
const index$3 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-9a6c839c"]]);
|
|
253
279
|
const _hoisted_1$2 = { class: "hlw-loading" };
|
|
254
280
|
const _hoisted_2$2 = {
|
|
255
281
|
key: 0,
|
package/dist/style.css
CHANGED
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
font-size: 28rpx;
|
|
58
58
|
color: #bbb;
|
|
59
59
|
}
|
|
60
|
-
.hlw-header[data-v-
|
|
60
|
+
.hlw-header[data-v-9a6c839c] {
|
|
61
61
|
position: sticky;
|
|
62
62
|
top: 0;
|
|
63
63
|
z-index: 999;
|
|
@@ -65,21 +65,18 @@
|
|
|
65
65
|
flex-direction: column;
|
|
66
66
|
overflow: hidden;
|
|
67
67
|
}
|
|
68
|
-
.header-bg-layer[data-v-
|
|
68
|
+
.header-bg-layer[data-v-9a6c839c] {
|
|
69
69
|
position: absolute;
|
|
70
|
-
|
|
71
|
-
left: 0;
|
|
72
|
-
right: 0;
|
|
73
|
-
bottom: 0;
|
|
70
|
+
inset: 0;
|
|
74
71
|
z-index: 0;
|
|
75
72
|
}
|
|
76
|
-
.status-bar-spacer[data-v-
|
|
73
|
+
.status-bar-spacer[data-v-9a6c839c] {
|
|
77
74
|
flex-shrink: 0;
|
|
78
75
|
width: 100%;
|
|
79
76
|
position: relative;
|
|
80
77
|
z-index: 1;
|
|
81
78
|
}
|
|
82
|
-
.header-content-area[data-v-
|
|
79
|
+
.header-content-area[data-v-9a6c839c] {
|
|
83
80
|
flex-shrink: 0;
|
|
84
81
|
width: 100%;
|
|
85
82
|
display: flex;
|
|
@@ -87,7 +84,7 @@
|
|
|
87
84
|
position: relative;
|
|
88
85
|
z-index: 1;
|
|
89
86
|
}
|
|
90
|
-
.header-back[data-v-
|
|
87
|
+
.header-back[data-v-9a6c839c] {
|
|
91
88
|
width: 88rpx;
|
|
92
89
|
height: 100%;
|
|
93
90
|
display: flex;
|
|
@@ -95,22 +92,31 @@
|
|
|
95
92
|
justify-content: center;
|
|
96
93
|
flex-shrink: 0;
|
|
97
94
|
}
|
|
98
|
-
.header-back
|
|
99
|
-
font-size:
|
|
95
|
+
.header-back-icon[data-v-9a6c839c] {
|
|
96
|
+
font-size: 36rpx;
|
|
100
97
|
}
|
|
101
|
-
.header-title[data-v-
|
|
98
|
+
.header-title[data-v-9a6c839c] {
|
|
102
99
|
flex: 1;
|
|
103
100
|
overflow: hidden;
|
|
101
|
+
}
|
|
102
|
+
.header-title--center[data-v-9a6c839c] {
|
|
103
|
+
text-align: center;
|
|
104
|
+
}
|
|
105
|
+
.header-title--left[data-v-9a6c839c] {
|
|
106
|
+
text-align: left;
|
|
107
|
+
padding-left: 4rpx;
|
|
108
|
+
}
|
|
109
|
+
.header-title-text[data-v-9a6c839c] {
|
|
110
|
+
display: block;
|
|
111
|
+
overflow: hidden;
|
|
104
112
|
text-overflow: ellipsis;
|
|
105
113
|
white-space: nowrap;
|
|
106
114
|
letter-spacing: 1rpx;
|
|
107
|
-
text-align: center;
|
|
108
|
-
}
|
|
109
|
-
.header-title text[data-v-91cf6eee] {
|
|
110
115
|
font-size: 26rpx;
|
|
111
116
|
font-weight: 500;
|
|
117
|
+
color: #14181f;
|
|
112
118
|
}
|
|
113
|
-
.header-placeholder[data-v-
|
|
119
|
+
.header-placeholder[data-v-9a6c839c] {
|
|
114
120
|
width: 88rpx;
|
|
115
121
|
flex-shrink: 0;
|
|
116
122
|
}
|
package/package.json
CHANGED
|
@@ -6,16 +6,28 @@
|
|
|
6
6
|
<view class="status-bar-spacer" :style="{ height: statusBarHeight + 'px' }"></view>
|
|
7
7
|
<view class="header-content-area" :style="{ height: NAV_BAR_CONTENT_HEIGHT + 'px' }">
|
|
8
8
|
<template v-if="props.isBack">
|
|
9
|
+
<!-- 返回按钮 -->
|
|
9
10
|
<view class="header-back" @click="handleBack">
|
|
10
|
-
<
|
|
11
|
+
<slot name="back-icon">
|
|
12
|
+
<text class="i-fa6-solid-chevron-left header-back-icon"></text>
|
|
13
|
+
</slot>
|
|
11
14
|
</view>
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
|
|
16
|
+
<!-- 标题 -->
|
|
17
|
+
<view class="header-title" :class="props.titleAlign === 'left' ? 'header-title--left' : 'header-title--center'">
|
|
18
|
+
<slot name="title">
|
|
19
|
+
<text class="header-title-text" :style="titleStyle">{{ props.title }}</text>
|
|
20
|
+
</slot>
|
|
14
21
|
</view>
|
|
15
|
-
|
|
22
|
+
|
|
23
|
+
<!-- 右侧占位(居中时保持对称) -->
|
|
24
|
+
<view v-if="props.titleAlign === 'center'" class="header-placeholder"></view>
|
|
16
25
|
</template>
|
|
26
|
+
|
|
17
27
|
<slot v-else>
|
|
18
|
-
<view v-if="props.title" class="header-title
|
|
28
|
+
<view v-if="props.title" class="header-title header-title--center">
|
|
29
|
+
<text class="header-title-text" :style="titleStyle">{{ props.title }}</text>
|
|
30
|
+
</view>
|
|
19
31
|
</slot>
|
|
20
32
|
</view>
|
|
21
33
|
</view>
|
|
@@ -51,6 +63,14 @@ interface Props {
|
|
|
51
63
|
bgClass?: string;
|
|
52
64
|
isBack?: boolean;
|
|
53
65
|
title?: string;
|
|
66
|
+
/** 标题对齐方式,默认 center */
|
|
67
|
+
titleAlign?: "center" | "left";
|
|
68
|
+
/** 标题字号,默认 26rpx */
|
|
69
|
+
titleSize?: string;
|
|
70
|
+
/** 标题字重,默认 500 */
|
|
71
|
+
titleWeight?: string | number;
|
|
72
|
+
/** 标题颜色 */
|
|
73
|
+
titleColor?: string;
|
|
54
74
|
}
|
|
55
75
|
|
|
56
76
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -58,6 +78,10 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
58
78
|
bgClass: "",
|
|
59
79
|
isBack: false,
|
|
60
80
|
title: "",
|
|
81
|
+
titleAlign: "center",
|
|
82
|
+
titleSize: "26rpx",
|
|
83
|
+
titleWeight: 500,
|
|
84
|
+
titleColor: "",
|
|
61
85
|
});
|
|
62
86
|
|
|
63
87
|
const emit = defineEmits<{
|
|
@@ -69,6 +93,12 @@ const handleBack = () => {
|
|
|
69
93
|
uni.navigateBack({ delta: 1 });
|
|
70
94
|
};
|
|
71
95
|
|
|
96
|
+
const titleStyle = computed(() => ({
|
|
97
|
+
fontSize: props.titleSize,
|
|
98
|
+
fontWeight: String(props.titleWeight),
|
|
99
|
+
...(props.titleColor ? { color: props.titleColor } : {}),
|
|
100
|
+
}));
|
|
101
|
+
|
|
72
102
|
const slots = useSlots();
|
|
73
103
|
const hasBgSlot = computed(() => !props.isBack && !!slots.bg);
|
|
74
104
|
const statusBarHeight = ref(getStatusBarHeight());
|
|
@@ -87,10 +117,7 @@ const totalNavBarHeight = computed(() => statusBarHeight.value + NAV_BAR_CONTENT
|
|
|
87
117
|
|
|
88
118
|
.header-bg-layer {
|
|
89
119
|
position: absolute;
|
|
90
|
-
|
|
91
|
-
left: 0;
|
|
92
|
-
right: 0;
|
|
93
|
-
bottom: 0;
|
|
120
|
+
inset: 0;
|
|
94
121
|
z-index: 0;
|
|
95
122
|
}
|
|
96
123
|
|
|
@@ -117,24 +144,35 @@ const totalNavBarHeight = computed(() => statusBarHeight.value + NAV_BAR_CONTENT
|
|
|
117
144
|
align-items: center;
|
|
118
145
|
justify-content: center;
|
|
119
146
|
flex-shrink: 0;
|
|
147
|
+
}
|
|
120
148
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
149
|
+
.header-back-icon {
|
|
150
|
+
font-size: 36rpx;
|
|
124
151
|
}
|
|
125
152
|
|
|
126
153
|
.header-title {
|
|
127
154
|
flex: 1;
|
|
128
155
|
overflow: hidden;
|
|
156
|
+
|
|
157
|
+
&--center {
|
|
158
|
+
text-align: center;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&--left {
|
|
162
|
+
text-align: left;
|
|
163
|
+
padding-left: 4rpx;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.header-title-text {
|
|
168
|
+
display: block;
|
|
169
|
+
overflow: hidden;
|
|
129
170
|
text-overflow: ellipsis;
|
|
130
171
|
white-space: nowrap;
|
|
131
172
|
letter-spacing: 1rpx;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
font-size: 26rpx;
|
|
136
|
-
font-weight: 500;
|
|
137
|
-
}
|
|
173
|
+
font-size: 26rpx;
|
|
174
|
+
font-weight: 500;
|
|
175
|
+
color: #14181f;
|
|
138
176
|
}
|
|
139
177
|
|
|
140
178
|
.header-placeholder {
|