App.vue 1.23 KB
<template>
  <div id="app" :class="$route.meta.showTabBar ? 'tab-bar-page' : ''">
    <template v-if="showWindow">
      <transition name="fade">
        <keep-alive>
          <router-view v-if="$route.meta.keepAlive"></router-view>
        </keep-alive>
      </transition>
      <transition name="fade">
        <router-view v-if="!$route.meta.keepAlive"></router-view>
      </transition>

      <!-- 底部全局 TabBar -->
      <TabBar v-if="$route.meta.showTabBar"></TabBar>
    </template>
  </div>
</template>

<script>
import TabBar from "@/components/tabBar/index.vue";

export default {
	name: "App",
	components: {
		TabBar,
	},
	data() {
		return {
			showWindow: false,
			tabBarRef: null,
		};
	},
	computed: {
		watchFlag() {
			return this.$store.state.app.showWindow;
		},
	},
	watch: {
		watchFlag: {
			immediate: true,
			handler(newval) {
				this.showWindow = newval;
				this.hideLoading();
			},
		},
	},
	mounted() {},

	methods: {},
};
</script>

<style lang="scss" scoped>
#app {
	height: 100%;
	width: 100%;
	overflow: hidden;
	box-sizing: border-box;
	padding-bottom: calc(env(safe-area-inset-bottom));
	background-color: white;
}
.tab-bar-page {
	padding-bottom: calc(46px + (env(safe-area-inset-bottom))) !important;
}
</style>