更换页面抖动解决方案

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