1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
   | <template>   <div class="dvapp">     
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
      <h2>app组件</h2>     <button @click="showComponent">显示、隐藏组件</button>          <div>         <transition name="odinam1" appear>             <Student v-show="isShow"></Student>         </transition>     </div>          <div>         <transition name="odinam2" appear>             <Student v-show="isShow"></Student>         </transition>     </div>           <div>         <transition-group name="odinam2" appear >             <Student v-show="isShow" key="1"></Student>             <Student v-show="!isShow" key="2"></Student>         </transition-group>     </div>           <div>         <transition-group name='animate__animated animate__bounce' appear enter-active-class='animate__shakeY'  leave-active-class='animate__bounceOutRight'>             <Student v-show="isShow" key="1"></Student>             <Student v-show="!isShow" key="2"></Student>         </transition-group>     </div>   </div> </template>
  <script> import Student from './components/Student.vue'; import 'animate.css' export default {     name: 'App',     data() {         return {             isShow:true         }     },     components: {         Student     },     methods: {         showComponent() {             this.isShow = !this.isShow;         }     }, } </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;    } .dvapp {     background-color: aquamarine; }
  .odinam2-enter-active,.odinam2-leave-active {     transition: 1s linear; } .odinam2-enter,.odinam2-leave-to {     transform: translateX(-100%); } .odinam2-enter-to,.odinam2-leave {     transform: translateX(0); }
  .odinam1-enter-active{     animation: odinAnimate 1s linear; } .odinam1-leave-active{     animation: odinAnimate 1s linear reverse; } @keyframes odinAnimate {     from{         transform: translateX(-100%);     }     to{         transform: translateX(0);     } } </style>
   |