App.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <div id="app">
  3. <nav>
  4. <router-link to="/">Home</router-link> |
  5. <router-link to="/about/100">About</router-link>|
  6. <!-- router-link 路由链接 组件 用于跳转到指定路由路径 -->
  7. <!-- to 路由路径 用于指定转转的路由路径 使用的就是routejs中的path -->
  8. <router-link to="/pageone">PageOne</router-link>|
  9. <!-- 重定向 -->
  10. <router-link to="/backhome">返回首页</router-link> |
  11. <!-- 别名 -->
  12. <router-link to="/info/200">Info</router-link>|
  13. <router-link to="/pagetwo">页面二</router-link>
  14. </nav>
  15. <!-- transition 过渡动画 -->
  16. <!-- name 过渡动画的名称 -->
  17. <transition name="fade">
  18. <router-view />
  19. </transition>
  20. </div>
  21. </template>
  22. <style>
  23. /* 过渡动画 */
  24. /* 将要进入的页面 过渡开始时候的样式 */
  25. .fade-enter{
  26. opacity: 0;
  27. }
  28. /* 将要进入的页面 进入的过程当中 */
  29. .fade-enter-active{
  30. transition: all 0.5s ease-in-out;
  31. }
  32. /* 将要进入的页面 进入完成的样式 */
  33. .fade-enter-to{
  34. opacity: 1;
  35. transition: all 0.5s ease-in-out;
  36. }
  37. /* 将要离开的页面 过渡开始时候的样式 */
  38. .fade-leave{
  39. opacity: 1;
  40. }
  41. /* 将要离开的页面 离开的过程当中 */
  42. .fade-leave-active{
  43. transition: all 0.5s ease-in-out;
  44. }
  45. /* 将要离开的页面 离开完成的样式 */
  46. .fade-leave-to{
  47. opacity: 0;
  48. transition: all 0.5s ease-in-out;
  49. }
  50. #app {
  51. font-family: Avenir, Helvetica, Arial, sans-serif;
  52. -webkit-font-smoothing: antialiased;
  53. -moz-osx-font-smoothing: grayscale;
  54. text-align: center;
  55. color: #2c3e50;
  56. }
  57. nav {
  58. padding: 30px;
  59. }
  60. nav a {
  61. font-weight: bold;
  62. color: #2c3e50;
  63. }
  64. nav a.router-link-exact-active {
  65. color: #42b983;
  66. }
  67. </style>