style: 样式展示问题
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user