| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <template>
- <div id="app">
- <nav>
- <router-link to="/">Home</router-link> |
- <router-link to="/about/100">About</router-link>|
- <!-- router-link 路由链接 组件 用于跳转到指定路由路径 -->
- <!-- to 路由路径 用于指定转转的路由路径 使用的就是routejs中的path -->
- <router-link to="/pageone">PageOne</router-link>|
- <!-- 重定向 -->
- <router-link to="/backhome">返回首页</router-link> |
- <!-- 别名 -->
- <router-link to="/info/200">Info</router-link>|
- <router-link to="/pagetwo">页面二</router-link>|
- <router-link to="/pagethree">页面三</router-link>|
- <router-link to="/pagefour">页面四</router-link>|
- </nav>
- <!-- transition 过渡动画 -->
- <!-- name 过渡动画的名称 -->
- <transition name="fade">
- <router-view />
- </transition>
- </div>
- </template>
- <style>
- /* 过渡动画 */
- /* 将要进入的页面 过渡开始时候的样式 */
- .fade-enter{
- opacity: 0;
- }
- /* 将要进入的页面 进入的过程当中 */
- .fade-enter-active{
- transition: all 0.5s ease-in-out;
- }
- /* 将要进入的页面 进入完成的样式 */
- .fade-enter-to{
- opacity: 1;
- transition: all 0.5s ease-in-out;
- }
- /* 将要离开的页面 过渡开始时候的样式 */
- .fade-leave{
- opacity: 1;
- }
- /* 将要离开的页面 离开的过程当中 */
- .fade-leave-active{
- transition: all 0.5s ease-in-out;
- }
- /* 将要离开的页面 离开完成的样式 */
- .fade-leave-to{
- opacity: 0;
- transition: all 0.5s ease-in-out;
- }
- #app {
- font-family: Avenir, Helvetica, Arial, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- text-align: center;
- color: #2c3e50;
- }
- nav {
- padding: 30px;
- }
- nav a {
- font-weight: bold;
- color: #2c3e50;
- }
- nav a.router-link-exact-active {
- color: #42b983;
- }
- </style>
|