
<template>
  <div>
    <p>vue 同时使用transition 和 animate.css</p>
    <button @click="change"> 触发动画</button>
    <!-- 自定义name 以及使用animated.css,添加apper实现页面刷新第一次触发动画
    type="transition" 定义以transition时长为准 animated默认时长1s
    -->
    <transition
    name='fade'
    :duration="{enter:5000,leave:10000}"
    appear
    enter-active-class="animate__animated animate__zoomIn" 
    leave-active-class="animate__animated animate__zoomOut"
    apper-active-class = "animate__animated animate__zoomIn"
    >
    
      <div class="div" v-if="show">
        hello 
      </div>
    </transition>
  </div>
</template>
 
<script type="text/ecmascript-6">
export default {
  data() {
    return {
      show: true,
    }
  },
  methods: {
    change() {
      this.show = !this.show
    }
  },
  components: {
  }
}
</script>
 
<style lang="less">
 
.div {
  width: 200px;
  height: 200px;
  background-color: pink;
  &.fade-enter ,.fade-leave-to{
    opacity: 0;
  }
  &.fade-enter-active,.fade-leave-active{
    transition: opacity 10s;
  }
}
</style>