一、封装

  1. <template>
  2. <transition>
  3. <slot name="fade"></slot>
  4. </transition>
  5. </template>
  6. <script>
  7. export default {
  8. name:"Fade"
  9. }
  10. </script>
  11. <style scoped>
  12. .v-leave-active,.v-enter-active{
  13. transition: opacity 4s;
  14. }
  15. .v-leave-to,.v-enter{
  16. opacity: 0;
  17. }
  18. </style>

二、使用

  1. <fade>
  2. <h1 slot="fade" v-show="isShow">this is an about page</h1>
  3. </fade>