老师好,请教一个路由跳转过渡效果不生效的问题
来源:2-7 【讨论题】模版语法的发展历程是怎样的?

目訫
2021-06-25
首先,我在组件中是这么写的
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<h2 @click="go('EssentialLinks')">Essential Links</h2>
<h2 @click="go('Ecosystem')">Ecosystem</h2>
<transition appear name="slide">
<router-view></router-view>
</transition>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
data () {
return {
msg: 'Welcome to Your Vue.js App'
}
},
methods: {
go (router) {
this.$router.push({
path: `/${router}`
})
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>
h1, h2 {
font-weight: normal;
}
.slide-enter-active, .slide-leave-active {
transition: all 0.3s
}
.slide-enter, .slide-leave-to {
transform: translate3d(100%, 0, 0)
}
</style>
跳转的页面就是一个列表
但是,如果我的路由表这么配置,页面时可以跳转,但是过渡效果没有生效
export default new Router({
routes: [
{
path: '/',
name: 'HelloWorld',
component: HelloWorld,
},
{
path: '/essentialLinks',
name: 'EssentialLinks',
component: EssentialLinks
},
{
path: '/ecosystem',
name: 'Ecosystem',
component: Ecosystem
}
]
})
router-view是基础的动态组建,应该是有动画效果的,希望老师可以帮忙解答,谢谢
写回答
1回答
-
目訫
提问者
2021-06-25
问题已经解决,因为页面中的<router-view>对应的就是子路由
00
相似问题