zoukankan      html  css  js  c++  java
  • Vue 用第三方的库去实现动画效果

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <title>Document</title>
      <script src="./lib/vue-2.4.0.js"></script>
      <!-- 这里引入第三方的动画js -->
      <link rel="stylesheet" href="./lib/animate.css">
      <!-- 入场fadelUp    离场 zoomOut -->
    </head>
    
    <body>
      <div id="app">
        <input type="button" value="点击" @click="flag=!flag">
        <!-- 需求: 点击按钮,让 h3 显示,再点击,让 h3 隐藏 -->
        <!-- 第一种方式: -->
        <transition enter-active-class="animated bounceIn" leave-active-class="animated bounceOut">
          <h3 v-if="flag">这是一个H3</h3>
        </transition>
        
        <!-- 第二种方式: -->
        <!-- 这里使用 :duration="毫秒值" 来统一设置 入场 和 离场 时候的动画时长 -->
        <transition enter-active-class="bounceIn" leave-active-class="bounceOut" :duration="200">
          <!-- 这里要使用animated库 先在元素上添加这个库 然后在选择哪个特效 -->
          <h3 v-if="flag" class="animated">这是一个H3</h3>
        </transition>
    
        <!-- 使用  :duration="{ enter: 200, leave: 400 }"  来分别设置 入场的时长 和 离场的时长  -->
        <transition enter-active-class="bounceIn" leave-active-class="zoomOut" :duration="{ enter: 2000, leave: 400 }">
          <h3 v-if="flag" class="animated">这是一个H3</h3>
        </transition>
      </div>
    
      <script>
        // 创建 Vue 实例,得到 ViewModel
        var vm = new Vue({
          el: '#app',
          data: {
            flag: false
          },
          methods: {}
        });
      </script>
    </body>
    
    </html>
  • 相关阅读:
    poj 1236 Network of Schools 强连通分量 (添加几条边可以使整个图变成强连通图)
    poj 2363 Sightseeing ( 找次短路和最短路的条数 )
    poj 3013
    poj 1679 The Unique MST 最小生成树
    poj 1797 Heavy Transportation (spfa 最短路 )
    hdu 2680 Choose the best route (spfa)
    畅通工程续
    find the longest of the shortest
    SimpleDateFormate的使用
    SimpleDateFormate的使用
  • 原文地址:https://www.cnblogs.com/wanguofeng/p/11237958.html
Copyright © 2011-2022 走看看