代码拉取完成,页面将自动刷新
<template>
<router-view v-slot="{ Component }">
<transition :name="transitionName">
<keep-alive>
<div :key="$route.name" class="root-div">
<component :is="Component" v-if="$route.meta.keepAlive" />
</div>
</keep-alive>
</transition>
<transition :name="transitionName">
<div :key="$route.name" class="root-div">
<component :is="Component" v-if="!$route.meta.keepAlive" />
</div>
</transition>
</router-view>
</template>
<script>
import { computed } from "vue";
import { useRoute } from "vue-router";
import { useStore } from "vuex";
import defaultSetting from "./settings";
export default {
name: "app",
setup() {
const store = useStore();
const route = useRoute();
const transitionName = computed(() => {
let routerUrl = route.path;
// 添加去除指定页面转场动画
if (["/", "/pointShopList", "/center"].includes(routerUrl)) {
return "";
}
if (!defaultSetting.needPageTrans) return "";
return store.state.direction;
});
return {
transitionName,
};
},
};
</script>
<style lang="scss">
.root-div {
position: absolute;
width: 100%;
}
.slide_left-enter-active,
.slide_left-leave-active,
.slide_right-enter-active,
.slide_right-leave-active {
transition: all 0.3s;
position: absolute !important;
background-color: white;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 1;
}
.slide_left-enter-from,
.slide_right-leave-to {
opacity: 1;
transform: translateX(100%);
}
.slide_right-enter-from,
.slide_left-leave-to {
opacity: 1;
transform: translateX(-1100%);
}
.slide_left-leave-to,
.slide_right-leave-to {
opacity: 0.6;
}
</style>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。