欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Vue 过度动画

程序员文章站 2022-05-02 20:05:58
...
<template>
  <div id="app">
    <img src="./assets/logo.png">
    <br>
    <router-link to="/">Home</router-link>|
    <router-link to="/params/198/jspang website is verygood">params</router-link>| 
    <router-link to="/goHome">goHome</router-link>|   
    <router-link to="/goParams/918/i live vuejs">goparams</router-link>|    
    <router-link to="/hi1">Hi1</router-link>
    <router-link to="/jspang">jspang</router-link>

    <transition name="fade" mode="out-in">
      <router-view/>
    </transition>
    
    
  </div>
</template>

<script>
export default {
  name: 'App'
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
.fade-enter {
  opacity:0;
}
.fade-leave{
  opacity:1;
}
.fade-enter-active{
  transition:opacity .5s;
}
.fade-leave-active{
  opacity:0;
  transition:opacity .5s;
}
</style>

<transition name="fade" mode="out-in">
      <router-view/>
    </transition>