<template>
  <div id="app">
    <button @click="show = !show">切换</button>
    <transition name="move">
      <MyTransition v-show="show" />
    </transition>
  </div>
</template>

<script>
import MyTransition from './components/MyTransition.vue';

export default {
  name: 'App',
  data() {
    return {
      show: true,
    };
  },
  components: {
    MyTransition,
  },
};
</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;
}

.move-enter-active {
  animation: move-frame 0.5s linear;
}
.move-leave-active {
  animation: move-frame 0.5s linear reverse;
}

@keyframes move-frame {
  0% {
    transform: translateY(-100px);
    opacity: 0;
  }

  50% {
    transform: translateY(-20px);
    opacity: 0.5;
  }

  100% {
    transform: translateY(0px);
    opacity: 1;
  }
}
</style>
