【发布时间】:2020-10-31 10:20:39
【问题描述】:
我刚开始学习vue并尝试做一个路由器转换。但是,当我在页面之间切换时,上面的代码没有任何转换。知道为什么吗? 额外的行,因为stackoverflow不允许我提交问题。
<template>
<div id="app">
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link><br><br>
</div>
<transition name="fade" mode="out-in">
<router-view></router-view>
</transition>
</div>
</template>
<script>
</script>
<style>
body {
background-color: #00ffcc;
margin: 0;
padding: 0;
}
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
overflow: hidden;
width: 100vw;
}
#nav {
padding: 30px;
}
#nav a {
font-weight: bold;
color: #2c3e50;
}
#nav a.router-link-exact-active {
color: #42b983;
}
.fade-enter, .fade-leave-to {
opacity: 0;
transform: translateX(2em);
}
.fade-enter-active, .fade-leave-active {
transition: all .3 ease;
}
</style>
【问题讨论】:
标签: javascript css vue.js