更换页面抖动解决方案

This commit is contained in:
TOP糯米 2023-03-08 16:44:35 +08:00
parent 55c200b1e9
commit 4fc458dc1f
1 changed files with 5 additions and 6 deletions

View File

@ -1,5 +1,5 @@
<template>
<view class="page-layout" v-show="showPage" :style="{ backgroundColor: backgroundColor, minHeight: minHeight }">
<view class="page-layout" v-show="isReady" :style="{ backgroundColor: backgroundColor, minHeight: minHeight }">
<view
v-if="showHeader"
class="page-header"
@ -41,7 +41,7 @@ export default {
name: "component-layout",
data() {
return {
showPage: false,
isReady: false,
headerHeight: 0,
statusBarHeight: 0,
bodyPaddingTop: 0,
@ -90,14 +90,11 @@ export default {
isLogin: (state) => state.user.token.length > 0,
}),
},
created() {
async created() {
if (this.isLogin) {
this.$store.dispatch("user/info");
}
},
async mounted() {
const { statusBarHeight, headerHeight } = await this.config;
this.showPage = true;
// #ifndef H5
this.statusBarHeight = statusBarHeight;
this.headerHeight = headerHeight;
@ -111,7 +108,9 @@ export default {
if (this.showHeader) {
this.bodyPaddingTop = safePaddingTop;
}
this.isReady = true;
},
mounted() {},
methods: {
onClick() {
if (this.customBtn) {