style: 样式展示问题

This commit is contained in:
2026-06-09 15:20:25 +08:00
parent 5551b08d5a
commit 6dee56e17f
8 changed files with 138 additions and 10 deletions
+107 -2
View File
@@ -72,11 +72,21 @@
<s-menu-tools />
</view>
<cardTabber v-if="props.tabbar" :path="tabbarPath" />
<view v-if="showUpdateProgress" class="update-progress-mask">
<view class="update-progress-card">
<view class="update-progress-title">{{ updateProgressText }}</view>
<view class="update-progress-bar">
<view class="update-progress-bar__fill" :style="{ width: updateProgress + '%' }"></view>
</view>
<view class="update-progress-percent">{{ updateProgress }}%</view>
</view>
</view>
</view>
</template>
<script setup>
import { getCurrentInstance, ref, computed, watch } from 'vue';
import { getCurrentInstance, ref, computed, watch, onMounted, onUnmounted } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import innerNavbar from '@/components/card_navbar/inner-navbar';
import cardNavbar from '@/components/card_navbar/card_navbar';
@@ -178,9 +188,36 @@
const modalStore = sheep.$store('modal');
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
let paddingTop = ref();
paddingTop.value = statusBarHeight + 44;
paddingTop.value = statusBarHeight + uni.upx2px(88);
const tabbarPath = ref('');
const showUpdateProgress = ref(false);
const updateProgress = ref(0);
const updateProgressText = ref('下载中...');
const HOT_UPDATE_PROGRESS_EVENT = '__hot_update_progress__';
const handleUpdateProgress = (payload) => {
if (!payload) return;
const type = String(payload.type || '');
if (type === 'show') {
showUpdateProgress.value = true;
updateProgress.value = 0;
updateProgressText.value = String(payload.text || '下载中...');
return;
}
if (type === 'set') {
showUpdateProgress.value = true;
updateProgress.value = Math.max(0, Math.min(100, Number(payload.percent) || 0));
if (payload.text) updateProgressText.value = String(payload.text);
return;
}
if (type === 'hide') {
showUpdateProgress.value = false;
updateProgress.value = 0;
updateProgressText.value = '下载中...';
}
};
const normalizePath = (p) => {
if (!p) return '';
@@ -200,6 +237,21 @@
onShow(() => updateTabbarPath());
watch(() => props.tabbar, () => updateTabbarPath(), { immediate: true });
onMounted(() => {
if (typeof uni !== 'undefined' && typeof uni.$on === 'function') {
uni.$on(HOT_UPDATE_PROGRESS_EVENT, handleUpdateProgress);
}
if (typeof uni !== 'undefined' && uni.__hotUpdatePendingProgress) {
handleUpdateProgress(uni.__hotUpdatePendingProgress);
}
});
onUnmounted(() => {
if (typeof uni !== 'undefined' && typeof uni.$off === 'function') {
uni.$off(HOT_UPDATE_PROGRESS_EVENT, handleUpdateProgress);
}
});
const pageConStyle = computed(() => {
const style = {
paddingTop: paddingTop.value + 'px',
@@ -323,4 +375,57 @@
.pageCon {
box-sizing: border-box;
}
.update-progress-mask {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.45);
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
padding: 40rpx;
box-sizing: border-box;
}
.update-progress-card {
width: 100%;
max-width: 560rpx;
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
box-sizing: border-box;
}
.update-progress-title {
font-size: 28rpx;
color: #333;
text-align: center;
margin-bottom: 20rpx;
}
.update-progress-bar {
height: 18rpx;
background: rgba(0, 0, 0, 0.08);
border-radius: 999rpx;
overflow: hidden;
}
.update-progress-bar__fill {
height: 100%;
background: var(--color2);
border-radius: 999rpx;
width: 0%;
transition: width 0.2s linear;
}
.update-progress-percent {
font-size: 28rpx;
color: #333;
text-align: center;
margin-top: 16rpx;
}
</style>
+5
View File
@@ -7,6 +7,7 @@
:showLeftButton="props.showLeftButton"
:goLeft="props.goLeft"
:tabbar="props.tabbar"
:navPreset="props.navPreset"
@onClickLeft="onClickLeft"
>
<template #navLeft>
@@ -88,6 +89,10 @@
type: [String, Boolean],
default: '',
},
navPreset: {
type: String,
default: '',
},
pink_bg: {
type: Boolean,
default: false,