App.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. <router-link to="/pagethree">页面三</router-link>|
  15. <router-link to="/pagefour">页面四</router-link>|
  16. </nav>
  17. <!-- transition 过渡动画 -->
  18. <!-- name 过渡动画的名称 -->
  19. <transition name="fade">
  20. <router-view />
  21. </transition>
  22. </div>
  23. </template>
  24. <style>
  25. /* 过渡动画 */
  26. /* 将要进入的页面 过渡开始时候的样式 */
  27. .fade-enter{
  28. opacity: 0;
  29. }
  30. /* 将要进入的页面 进入的过程当中 */
  31. .fade-enter-active{
  32. transition: all 0.5s ease-in-out;
  33. }
  34. /* 将要进入的页面 进入完成的样式 */
  35. .fade-enter-to{
  36. opacity: 1;
  37. transition: all 0.5s ease-in-out;
  38. }
  39. /* 将要离开的页面 过渡开始时候的样式 */
  40. .fade-leave{
  41. opacity: 1;
  42. }
  43. /* 将要离开的页面 离开的过程当中 */
  44. .fade-leave-active{
  45. transition: all 0.5s ease-in-out;
  46. }
  47. /* 将要离开的页面 离开完成的样式 */
  48. .fade-leave-to{
  49. opacity: 0;
  50. transition: all 0.5s ease-in-out;
  51. }
  52. #app {
  53. font-family: Avenir, Helvetica, Arial, sans-serif;
  54. -webkit-font-smoothing: antialiased;
  55. -moz-osx-font-smoothing: grayscale;
  56. text-align: center;
  57. color: #2c3e50;
  58. }
  59. nav {
  60. padding: 30px;
  61. }
  62. nav a {
  63. font-weight: bold;
  64. color: #2c3e50;
  65. }
  66. nav a.router-link-exact-active {
  67. color: #42b983;
  68. }
  69. </style>