<transition name="left"> <router-view v-if="getCms" class="Router"/> </transition> data() { names: ‘left‘ } watch: { ‘$route‘(to, from) { if (to.index < from.index) { this.names = "right" } else { this.names = "left" } } } .left-enter { transform: translateX(100%); } .left-enter-to { transform: translateX(0); } .left-enter-active { transition: 1s; } .left-leave { transform: translateX(0); } .left-leave-to { transform: translateX(-100%); } .left-leave-active { transition: .5s; } .right-enter { transform: translateX(-100%); } .right-enter-active { transition: .5s; } .right-leave-to { transform: translateX(100%); } .right-leave-active { transition: .5s; }
原文地址:https://www.cnblogs.com/1rookie/p/10151719.html
时间: 2024-10-12 18:34:09