首页 > 其他 > 详细

用Vue 实现animate动画

时间:2020-12-26 11:43:29      阅读:23      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="./animate.min.css" />
    <script src="./vue.js"></script>
    <style>
      .box {
        width: 100px;
        height: 100px;
        background-color: red;
      }
      .custom-enter-active {
        animation-name: zoomIn;
        animation-duration: 10s;
      }
      .custom-leave-active {
        animation-name: zoomOut;
        animation-duration: 2s;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <input type="checkbox" v-model="show" />显示/隐藏
      <hr />
      <!-- 方式一: 使用自定义过渡名 -->
      <transition
        enter-active-class="animate__zoomIn"
        leave-active-class="animate__zoomOut"
      >
        <div class="box animate__animated" v-show="show"></div>
      </transition>
      <br />
      <br />
      <br />
      <!-- 方式二: 使用自定义过渡名 -->
      <transition name="custom">
        <div class="box animate__animated" v-show="show"></div>
      </transition>
    </div>
    <script>
      let vm = new Vue({
        el: "#app",
        data: {
          show: true,
        },
      });
    </script>
  </body>
</html>
 
效果如下:
技术分享图片

 

 

用Vue 实现animate动画

原文:https://www.cnblogs.com/yangcaicai/p/14191595.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!