@hlw-uni/mp-vue 2.1.58 → 2.1.60

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.mjs CHANGED
@@ -4,9 +4,8 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { ref, onBeforeUpdate, onUnmounted, computed, createSSRApp } from "vue";
7
+ import { ref, onBeforeUpdate, onUnmounted, createSSRApp } from "vue";
8
8
  import { onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
9
- import { defineStore } from "pinia";
10
9
  const cosAdapter = {
11
10
  name: "cos",
12
11
  /**
@@ -335,6 +334,15 @@ function ServicePrefix(value) {
335
334
  target.prototype.servicePrefix = typeof value === "string" ? value : value.prefix;
336
335
  };
337
336
  }
337
+ function PluginService(target) {
338
+ Object.defineProperty(target.prototype, "servicePrefix", {
339
+ get() {
340
+ return globalThis.VITE_PLUGIN_NAME || "";
341
+ },
342
+ enumerable: true,
343
+ configurable: true
344
+ });
345
+ }
338
346
  function useMsg() {
339
347
  function toast(opts) {
340
348
  const {
@@ -959,364 +967,6 @@ function useNavigate() {
959
967
  miniProgram: (appId, options) => navigate("miniprogram", appId, options)
960
968
  };
961
969
  }
962
- const useThemeStore = defineStore(
963
- "theme",
964
- () => {
965
- const scale = ref("normal");
966
- function setScale(s) {
967
- scale.value = s;
968
- uni.setStorageSync(FONT_SCALE_KEY, s);
969
- uni.$emit(THEME_CHANGE_EVENT);
970
- }
971
- const fontOptions = Object.keys(FONT_PRESETS).map((key) => ({
972
- value: key,
973
- label: FONT_PRESETS[key].label
974
- }));
975
- const primaryColor = ref(DEFAULT_THEMES[0].value);
976
- const themes = DEFAULT_THEMES;
977
- const activeTheme = computed(
978
- () => themes.find((t) => t.value === primaryColor.value) ?? { label: "自定义", value: primaryColor.value }
979
- );
980
- function setTheme(color) {
981
- primaryColor.value = color;
982
- uni.setStorageSync(THEME_COLOR_KEY, color);
983
- uni.$emit(THEME_CHANGE_EVENT);
984
- }
985
- const appearance = ref("auto");
986
- const appearanceOptions = APPEARANCE_PRESETS;
987
- const appearanceMode = computed(() => resolveAppearance(appearance.value));
988
- const isDark = computed(() => appearanceMode.value === "dark");
989
- function setAppearance(a) {
990
- appearance.value = a;
991
- uni.setStorageSync(APPEARANCE_KEY, a);
992
- uni.$emit(THEME_CHANGE_EVENT);
993
- }
994
- return {
995
- // 字体
996
- scale,
997
- fontOptions,
998
- setScale,
999
- // 主题色
1000
- primaryColor,
1001
- themes,
1002
- activeTheme,
1003
- setTheme,
1004
- // 外观模式
1005
- appearance,
1006
- appearanceOptions,
1007
- appearanceMode,
1008
- isDark,
1009
- setAppearance
1010
- };
1011
- },
1012
- { unistorage: true }
1013
- );
1014
- const FONT_SCALE_KEY = "hlw_font_scale";
1015
- const FONT_PRESETS = {
1016
- small: {
1017
- label: "较小",
1018
- vars: {
1019
- "--font-xs": "16rpx",
1020
- "--font-sm": "20rpx",
1021
- "--font-base": "24rpx",
1022
- "--font-md": "28rpx",
1023
- "--font-lg": "32rpx",
1024
- "--font-xl": "36rpx"
1025
- }
1026
- },
1027
- compact: {
1028
- label: "略小",
1029
- vars: {
1030
- "--font-xs": "18rpx",
1031
- "--font-sm": "22rpx",
1032
- "--font-base": "26rpx",
1033
- "--font-md": "30rpx",
1034
- "--font-lg": "34rpx",
1035
- "--font-xl": "38rpx"
1036
- }
1037
- },
1038
- normal: {
1039
- label: "标准",
1040
- vars: {
1041
- "--font-xs": "20rpx",
1042
- "--font-sm": "24rpx",
1043
- "--font-base": "28rpx",
1044
- "--font-md": "32rpx",
1045
- "--font-lg": "36rpx",
1046
- "--font-xl": "40rpx"
1047
- }
1048
- },
1049
- medium: {
1050
- label: "适中",
1051
- vars: {
1052
- "--font-xs": "22rpx",
1053
- "--font-sm": "28rpx",
1054
- "--font-base": "32rpx",
1055
- "--font-md": "36rpx",
1056
- "--font-lg": "42rpx",
1057
- "--font-xl": "46rpx"
1058
- }
1059
- },
1060
- large: {
1061
- label: "较大",
1062
- vars: {
1063
- "--font-xs": "24rpx",
1064
- "--font-sm": "30rpx",
1065
- "--font-base": "34rpx",
1066
- "--font-md": "40rpx",
1067
- "--font-lg": "46rpx",
1068
- "--font-xl": "52rpx"
1069
- }
1070
- },
1071
- xlarge: {
1072
- label: "超大",
1073
- vars: {
1074
- "--font-xs": "28rpx",
1075
- "--font-sm": "36rpx",
1076
- "--font-base": "42rpx",
1077
- "--font-md": "48rpx",
1078
- "--font-lg": "56rpx",
1079
- "--font-xl": "64rpx"
1080
- }
1081
- },
1082
- xxlarge: {
1083
- label: "特大",
1084
- vars: {
1085
- "--font-xs": "32rpx",
1086
- "--font-sm": "42rpx",
1087
- "--font-base": "48rpx",
1088
- "--font-md": "56rpx",
1089
- "--font-lg": "64rpx",
1090
- "--font-xl": "72rpx"
1091
- }
1092
- }
1093
- };
1094
- function getCurrentFontScale() {
1095
- try {
1096
- const v = uni.getStorageSync(FONT_SCALE_KEY);
1097
- if (v === "small" || v === "compact" || v === "medium" || v === "large" || v === "xlarge" || v === "xxlarge")
1098
- return v;
1099
- } catch {
1100
- }
1101
- return "normal";
1102
- }
1103
- function getCurrentFontVars() {
1104
- return FONT_PRESETS[getCurrentFontScale()].vars;
1105
- }
1106
- const THEME_COLOR_KEY = "hlw_theme_color";
1107
- const THEME_SEMANTIC_COLORS = {
1108
- success: "#10b981",
1109
- warning: "#f59e0b",
1110
- error: "#ef4444",
1111
- info: "#64748b"
1112
- };
1113
- const DEFAULT_THEMES = [
1114
- { label: "翡翠绿", value: "#10b981" },
1115
- { label: "活力橙", value: "#f97316" },
1116
- { label: "默认蓝", value: "#3b82f6" },
1117
- { label: "玫瑰粉", value: "#f43f5e" },
1118
- { label: "紫罗兰", value: "#8b5cf6" },
1119
- { label: "青石灰", value: "#64748b" }
1120
- ];
1121
- function getCurrentThemeColor() {
1122
- try {
1123
- const v = uni.getStorageSync(THEME_COLOR_KEY);
1124
- if (v && typeof v === "string")
1125
- return v;
1126
- } catch {
1127
- }
1128
- return DEFAULT_THEMES[0].value;
1129
- }
1130
- function getCurrentThemeVars() {
1131
- const color = getCurrentThemeColor();
1132
- return {
1133
- "--primary-color": color,
1134
- "--primary-light": hexToRgba(color, 0.12),
1135
- "--primary-dark": darkenHex(color),
1136
- "--primary-success": THEME_SEMANTIC_COLORS.success,
1137
- "--primary-success-light": hexToRgba(THEME_SEMANTIC_COLORS.success, 0.12),
1138
- "--primary-success-dark": darkenHex(THEME_SEMANTIC_COLORS.success),
1139
- "--primary-warning": THEME_SEMANTIC_COLORS.warning,
1140
- "--primary-warning-light": hexToRgba(THEME_SEMANTIC_COLORS.warning, 0.12),
1141
- "--primary-warning-dark": darkenHex(THEME_SEMANTIC_COLORS.warning),
1142
- "--primary-error": THEME_SEMANTIC_COLORS.error,
1143
- "--primary-error-light": hexToRgba(THEME_SEMANTIC_COLORS.error, 0.12),
1144
- "--primary-error-dark": darkenHex(THEME_SEMANTIC_COLORS.error),
1145
- "--primary-info": THEME_SEMANTIC_COLORS.info,
1146
- "--primary-info-light": hexToRgba(THEME_SEMANTIC_COLORS.info, 0.12),
1147
- "--primary-info-dark": darkenHex(THEME_SEMANTIC_COLORS.info),
1148
- "--success-color": THEME_SEMANTIC_COLORS.success,
1149
- "--success-light": hexToRgba(THEME_SEMANTIC_COLORS.success, 0.12),
1150
- "--success-dark": darkenHex(THEME_SEMANTIC_COLORS.success),
1151
- "--warning-color": THEME_SEMANTIC_COLORS.warning,
1152
- "--warning-light": hexToRgba(THEME_SEMANTIC_COLORS.warning, 0.12),
1153
- "--warning-dark": darkenHex(THEME_SEMANTIC_COLORS.warning),
1154
- "--error-color": THEME_SEMANTIC_COLORS.error,
1155
- "--error-light": hexToRgba(THEME_SEMANTIC_COLORS.error, 0.12),
1156
- "--error-dark": darkenHex(THEME_SEMANTIC_COLORS.error),
1157
- "--info-color": THEME_SEMANTIC_COLORS.info,
1158
- "--info-light": hexToRgba(THEME_SEMANTIC_COLORS.info, 0.12),
1159
- "--info-dark": darkenHex(THEME_SEMANTIC_COLORS.info)
1160
- };
1161
- }
1162
- const HEX_RE = /^#[0-9a-fA-F]{6}$/;
1163
- function parseHex(hex) {
1164
- if (!HEX_RE.test(hex))
1165
- throw new Error(`Invalid hex color: ${hex}`);
1166
- return [
1167
- parseInt(hex.slice(1, 3), 16),
1168
- parseInt(hex.slice(3, 5), 16),
1169
- parseInt(hex.slice(5, 7), 16)
1170
- ];
1171
- }
1172
- function hexToRgba(hex, alpha) {
1173
- const [r, g, b] = parseHex(hex);
1174
- return `rgba(${r},${g},${b},${alpha})`;
1175
- }
1176
- function darkenHex(hex, amount = 0.15) {
1177
- const [r, g, b] = parseHex(hex);
1178
- const darken = (value) => Math.max(0, Math.round(value * (1 - amount)));
1179
- return `#${darken(r).toString(16).padStart(2, "0")}${darken(g).toString(16).padStart(2, "0")}${darken(b).toString(16).padStart(2, "0")}`;
1180
- }
1181
- const APPEARANCE_KEY = "hlw_appearance";
1182
- const APPEARANCE_PRESETS = [
1183
- { value: "light", label: "浅色模式" },
1184
- { value: "dark", label: "深色模式" },
1185
- { value: "auto", label: "跟随系统" }
1186
- ];
1187
- const LIGHT_VARS = {
1188
- "--bg-page": "#f6f6f6",
1189
- "--bg-elevated": "#ffffff",
1190
- "--surface-card": "#ffffff",
1191
- "--surface-card-muted": "#f8fafc",
1192
- "--surface-secondary": "#f1f5f9",
1193
- "--surface-tertiary": "#e2e8f0",
1194
- "--text-primary": "#0f172a",
1195
- "--text-secondary": "#334155",
1196
- "--text-muted": "#64748b",
1197
- "--text-subtle": "#94a3b8",
1198
- "--text-disabled": "#cbd5e1",
1199
- "--border-color": "#e2e8f0",
1200
- "--border-color-light": "#f1f5f9",
1201
- "--border-color-focus": "#bfdbfe",
1202
- "--shadow-soft": "0 2rpx 8rpx rgba(15, 23, 42, 0.04)",
1203
- "--shadow-card": "0 4rpx 16rpx rgba(15, 23, 42, 0.06)"
1204
- };
1205
- const DARK_VARS = {
1206
- "--bg-page": "#0b1020",
1207
- "--bg-elevated": "#111827",
1208
- "--surface-card": "#1e293b",
1209
- "--surface-card-muted": "#273549",
1210
- "--surface-secondary": "#273549",
1211
- "--surface-tertiary": "#334155",
1212
- "--text-primary": "#f8fafc",
1213
- "--text-secondary": "#cbd5e1",
1214
- "--text-muted": "#94a3b8",
1215
- "--text-subtle": "#64748b",
1216
- "--text-disabled": "#475569",
1217
- "--border-color": "#334155",
1218
- "--border-color-light": "#1e293b",
1219
- "--border-color-focus": "#3b82f6",
1220
- "--shadow-soft": "0 2rpx 8rpx rgba(0, 0, 0, 0.3)",
1221
- "--shadow-card": "0 4rpx 16rpx rgba(0, 0, 0, 0.35)"
1222
- };
1223
- const APPEARANCE_VAR_MAP = {
1224
- light: LIGHT_VARS,
1225
- dark: DARK_VARS
1226
- };
1227
- function getCurrentAppearance() {
1228
- try {
1229
- const v = uni.getStorageSync(APPEARANCE_KEY);
1230
- if (v === "light" || v === "dark" || v === "auto")
1231
- return v;
1232
- } catch {
1233
- }
1234
- return "auto";
1235
- }
1236
- function resolveAppearance(appearance) {
1237
- if (appearance === "light" || appearance === "dark")
1238
- return appearance;
1239
- try {
1240
- const info = uni.getSystemInfoSync();
1241
- if (info.theme === "dark")
1242
- return "dark";
1243
- } catch {
1244
- }
1245
- return "light";
1246
- }
1247
- function getCurrentAppearanceMode() {
1248
- return resolveAppearance(getCurrentAppearance());
1249
- }
1250
- function getCurrentAppearanceVars() {
1251
- return APPEARANCE_VAR_MAP[getCurrentAppearanceMode()];
1252
- }
1253
- const TYPOGRAPHY_ROLES = {
1254
- "title-lg": {
1255
- size: "var(--font-xl)",
1256
- weight: "600",
1257
- lineHeight: "1.2",
1258
- color: "var(--text-primary)"
1259
- },
1260
- "title": {
1261
- size: "var(--font-md)",
1262
- weight: "500",
1263
- lineHeight: "1.3",
1264
- color: "var(--text-primary)"
1265
- },
1266
- "subtitle": {
1267
- size: "var(--font-base)",
1268
- weight: "500",
1269
- lineHeight: "1.3",
1270
- color: "var(--text-secondary)"
1271
- },
1272
- "body": {
1273
- size: "var(--font-base)",
1274
- weight: "400",
1275
- lineHeight: "1.5",
1276
- color: "var(--text-secondary)"
1277
- },
1278
- "desc": {
1279
- size: "var(--font-sm)",
1280
- weight: "400",
1281
- lineHeight: "1.4",
1282
- color: "var(--text-subtle)"
1283
- },
1284
- "caption": {
1285
- size: "var(--font-xs)",
1286
- weight: "500",
1287
- lineHeight: "1.3",
1288
- color: "var(--text-muted)"
1289
- }
1290
- };
1291
- function getCurrentTypographyVars() {
1292
- const vars = {};
1293
- for (const [role, cfg] of Object.entries(TYPOGRAPHY_ROLES)) {
1294
- vars[`--text-${role}-size`] = cfg.size;
1295
- vars[`--text-${role}-weight`] = cfg.weight;
1296
- vars[`--text-${role}-line-height`] = cfg.lineHeight;
1297
- vars[`--text-${role}-color`] = cfg.color;
1298
- }
1299
- return vars;
1300
- }
1301
- const THEME_CHANGE_EVENT = "hlw:theme-change";
1302
- function buildThemeStyle() {
1303
- return varsToStyle({
1304
- ...getCurrentFontVars(),
1305
- ...getCurrentThemeVars()
1306
- });
1307
- }
1308
- function varsToStyle(vars) {
1309
- return Object.entries(vars).map(([key, value]) => `${key}:${value}`).join(";") + ";";
1310
- }
1311
- function useThemePageStyle() {
1312
- const store = useThemeStore();
1313
- const themePageStyle = computed(() => {
1314
- void store.scale;
1315
- void store.primaryColor;
1316
- return buildThemeStyle();
1317
- });
1318
- return { themePageStyle };
1319
- }
1320
970
  let _msg = null;
1321
971
  let _utils = null;
1322
972
  const hlw = {
@@ -1392,41 +1042,22 @@ const vCopy = {
1392
1042
  }
1393
1043
  };
1394
1044
  export {
1395
- APPEARANCE_KEY,
1396
- APPEARANCE_PRESETS,
1397
- APPEARANCE_VAR_MAP,
1398
1045
  BaseService,
1399
- DEFAULT_THEMES,
1400
- FONT_PRESETS,
1401
- FONT_SCALE_KEY,
1046
+ PluginService,
1402
1047
  ServiceNamespace,
1403
1048
  ServicePrefix,
1404
- THEME_CHANGE_EVENT,
1405
- THEME_COLOR_KEY,
1406
- THEME_SEMANTIC_COLORS,
1407
- TYPOGRAPHY_ROLES,
1408
1049
  adapters,
1409
1050
  alistAdapter,
1410
1051
  auth,
1411
- buildThemeStyle,
1412
1052
  clearDeviceCache,
1413
1053
  copy,
1414
1054
  cosAdapter,
1415
1055
  download,
1416
1056
  getAdapter,
1417
- getCurrentAppearance,
1418
- getCurrentAppearanceMode,
1419
- getCurrentAppearanceVars,
1420
- getCurrentFontScale,
1421
- getCurrentFontVars,
1422
- getCurrentThemeColor,
1423
- getCurrentThemeVars,
1424
- getCurrentTypographyVars,
1425
1057
  hlw,
1426
1058
  ossAdapter,
1427
1059
  paste,
1428
1060
  qiniuAdapter,
1429
- resolveAppearance,
1430
1061
  saveImage,
1431
1062
  saveImageUrl,
1432
1063
  saveVideoFile,
@@ -1443,8 +1074,6 @@ export {
1443
1074
  useRefs,
1444
1075
  useRequest,
1445
1076
  useShare,
1446
- useThemePageStyle,
1447
- useThemeStore,
1448
1077
  useUpload,
1449
1078
  useUtils,
1450
1079
  vCopy,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hlw-uni/mp-vue",
3
- "version": "2.1.58",
3
+ "version": "2.1.60",
4
4
  "description": "hlw-uni 小程序运行时 — Vue 组件 + composables + theme + http + 工具集(合并自原 mp-core)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -40,7 +40,7 @@
40
40
  "typescript": "^4.9.5",
41
41
  "vite": "5.2.8",
42
42
  "vite-plugin-dts": "^4.5.4",
43
- "vue": "^3.5.32"
43
+ "vue": "^3.5.34"
44
44
  },
45
45
  "dependencies": {
46
46
  "md5": "^2.3.0",
@@ -0,0 +1,118 @@
1
+ <template>
2
+ <view class="contact-card">
3
+ <view class="contact-copy">
4
+ <text class="contact-title">{{ title }}</text>
5
+ <text class="contact-desc">{{ desc }}</text>
6
+ </view>
7
+ <button
8
+ class="contact-button"
9
+ open-type="contact"
10
+ :send-message-title="resolvedContact.title"
11
+ :send-message-path="resolvedContact.path"
12
+ :send-message-img="resolvedContact.img"
13
+ :show-message-card="resolvedContact.show"
14
+ >
15
+ <text class="iconfont icon-service" />
16
+ <text class="contact-button-text">{{ resolvedBtnTitle }}</text>
17
+ </button>
18
+ </view>
19
+ </template>
20
+
21
+ <script setup lang="ts">
22
+ import { computed } from "vue";
23
+
24
+ interface ContactConfig {
25
+ send_message_title?: string;
26
+ send_message_path?: string;
27
+ send_message_img?: string;
28
+ show_message_card?: boolean;
29
+ }
30
+
31
+ const props = withDefaults(
32
+ defineProps<{
33
+ title: string;
34
+ desc: string;
35
+ btn_title?: string;
36
+ contact?: ContactConfig;
37
+ }>(),
38
+ {
39
+ btn_title: "",
40
+ contact: () => ({}),
41
+ }
42
+ );
43
+
44
+ const resolvedBtnTitle = computed(() => {
45
+ return props.btn_title || "联系客服";
46
+ });
47
+
48
+ const resolvedContact = computed(() => {
49
+ const c = props.contact || {};
50
+ return {
51
+ title: c.send_message_title ?? "",
52
+ path: c.send_message_path ?? "",
53
+ img: c.send_message_img ?? "",
54
+ show: c.show_message_card ?? false,
55
+ };
56
+ });
57
+ </script>
58
+
59
+ <style scoped lang="scss">
60
+ .contact-card {
61
+ display: flex;
62
+ align-items: center;
63
+ justify-content: space-between;
64
+ padding: var(--card-padding);
65
+ border: 1rpx solid var(--border-color-light);
66
+ border-radius: var(--card-radius);
67
+ background: linear-gradient(135deg, #ffffff 0%, rgba(49, 118, 255, 0.05) 100%);
68
+ }
69
+
70
+ .contact-copy {
71
+ display: flex;
72
+ min-width: 0;
73
+ flex: 1;
74
+ flex-direction: column;
75
+ margin-right: 22rpx;
76
+ }
77
+
78
+ .contact-title {
79
+ margin-bottom: 8rpx;
80
+ color: #1f2937;
81
+ font-size: var(--font-base);
82
+ line-height: 1.3;
83
+ letter-spacing: 3rpx;
84
+ }
85
+
86
+ .contact-desc {
87
+ color: #94a3b8;
88
+ font-size: var(--font-sm);
89
+ line-height: 1.45;
90
+ letter-spacing: 3rpx;
91
+ }
92
+
93
+ .contact-button {
94
+ display: flex;
95
+ align-items: center;
96
+ justify-content: center;
97
+ gap: 10rpx;
98
+ width: 176rpx;
99
+ height: 68rpx;
100
+ flex-shrink: 0;
101
+ margin: 0;
102
+ border-radius: var(--radius-full);
103
+ background: #3176ff;
104
+ color: #ffffff;
105
+ font: inherit;
106
+ line-height: 68rpx;
107
+ }
108
+
109
+ .contact-button .iconfont {
110
+ font-size: var(--font-sm);
111
+ }
112
+
113
+ .contact-button-text {
114
+ color: inherit;
115
+ font-size: var(--font-sm);
116
+ line-height: 1;
117
+ }
118
+ </style>
@@ -0,0 +1,121 @@
1
+ <template>
2
+ <view class="navbar">
3
+ <view :style="bar_style"></view>
4
+ <view class="header" :style="{ height: header_height + 'px' }">
5
+ <view @tap="tapBack" class="left" v-if="props.isBack">
6
+ <text class="i-fa6-solid-chevron-left icon-left"></text>
7
+ </view>
8
+ <text class="title">{{ title }}</text>
9
+ </view>
10
+ <view class="status-bar" v-if="theme != 'light-theme'">
11
+ <view class="within"></view>
12
+ </view>
13
+ </view>
14
+ <view :style="{ height: navbar_height + 'px' }"></view>
15
+ </template>
16
+
17
+ <script lang="ts" setup>
18
+ import { computed, ref } from "vue";
19
+ import { useTheme } from "@/core";
20
+ const { theme } = useTheme();
21
+
22
+ const statusBarHeight: number = uni.getSystemInfoSync()?.statusBarHeight || 0;
23
+ const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
24
+
25
+ const props = defineProps({
26
+ isBar: {
27
+ type: Boolean,
28
+ default: false,
29
+ },
30
+ title: {
31
+ type: String,
32
+ default: "",
33
+ },
34
+ isBack: {
35
+ type: Boolean,
36
+ default: false,
37
+ },
38
+ });
39
+
40
+ const bar_style = computed(() => {
41
+ const style = {
42
+ height: statusBarHeight + "px",
43
+ };
44
+ return style;
45
+ });
46
+ let status_bar_height = 0;
47
+ if (props.isBar) {
48
+ status_bar_height = 15;
49
+ }
50
+
51
+ const header_height = ref<number>(menuButtonInfo.bottom - statusBarHeight + 3);
52
+ const navbar_height = ref(header_height.value + statusBarHeight);
53
+ const status_bar_height_style = `${status_bar_height}px`;
54
+
55
+ function tapBack() {
56
+ uni.navigateBack({
57
+ fail: (err) => {
58
+ uni.reLaunch({
59
+ url: "/pages/index/index",
60
+ });
61
+ },
62
+ });
63
+ }
64
+ </script>
65
+
66
+ <style lang="scss" scoped>
67
+ .navbar {
68
+ display: flex;
69
+ flex-direction: column;
70
+ background-color: var(--navbar-bg-color);
71
+ position: fixed;
72
+ width: 750rpx;
73
+ z-index: 999;
74
+ border-bottom: var(--navbar-border-bottom);
75
+
76
+ .header {
77
+ display: flex;
78
+ flex-direction: row;
79
+ align-items: center;
80
+ justify-content: center;
81
+ position: relative;
82
+
83
+ .left {
84
+ position: absolute;
85
+ display: flex;
86
+ align-items: center;
87
+ justify-content: center;
88
+ left: 0rpx;
89
+ width: 100rpx;
90
+ height: 100%;
91
+
92
+ .icon-left {
93
+ color: var(--navbar-left-color);
94
+ }
95
+ }
96
+
97
+ .title {
98
+ font-size: var(--navbar-font-size);
99
+ color: var(--navbar-title-color);
100
+ letter-spacing: 3rpx;
101
+ font-weight: bold;
102
+ }
103
+ }
104
+
105
+ .status-bar {
106
+ background-color: var(--navbar-bg-color);
107
+ height: v-bind(status_bar_height_style);
108
+ width: 750rpx;
109
+ position: relative;
110
+
111
+ .within {
112
+ position: absolute;
113
+ width: 750rpx;
114
+ height: v-bind(status_bar_height_style);
115
+ background-color: var(--bg-color);
116
+ border-top-left-radius: var(--status-bar-border);
117
+ border-top-right-radius: var(--status-bar-border);
118
+ }
119
+ }
120
+ }
121
+ </style>