2 Star 13 Fork 1

高翔/shop-template-vue3x

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
App.vue 1.69 KB
一键复制 编辑 原始数据 按行查看 历史
<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>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/lovegaoxiang/shop-template-vue3x.git
git@gitee.com:lovegaoxiang/shop-template-vue3x.git
lovegaoxiang
shop-template-vue3x
shop-template-vue3x
master

搜索帮助