zoukankan      html  css  js  c++  java
  • vue使用animate.css

    1.在main.js中引入animate.css

    import './assets/animate.css'

    2.使用transition标签包裹运动的元素,使用enter-active-class定义进入动画,使用leave-active-class定义离开动画,注意animate.css的所有动画要加animated这个类

       <transition enter-active-class="animated bounce" leave-active-class="animated hinge">
            <div class="box" v-show="show"></div>
        </transition>

    例子:

    <template>
    <div>
        <transition enter-active-class="animated bounce" leave-active-class="animated hinge">
            <div class="box" v-show="show"></div>
        </transition>
        <button @click="toggle()">切换</button>
    </div>
    </template>
    <script>
    export default {
      name: "Home",
      data () {
        return {
            show:true
        };
      },
      methods:{
          toggle(){
              this.show = !this.show
          }
      }
    }
    </script>
    <style lang="css" scoped>
    .box{
        width: 300px;
        height: 300px;
        background-color: red;
        margin: 0 auto;
    }
    </style>
  • 相关阅读:
    jQuery-css
    了解jQuery
    jQuery属性
    jQuery常用效果
    jQuery_$工具方法
    jQuery选择器
    jQuery核心对象
    $
    jQuery两把利器
    JavaScriptDOM
  • 原文地址:https://www.cnblogs.com/luguankun/p/10880052.html
Copyright © 2011-2022 走看看