• Vue 1.0动画


    Vue 1.0动画(自定义动画)

    步骤:

      1.给当前动画元素添加‘transition’属性  其值就是动画名称(假如:fade)

      2.给动画名称写css定义

        a: .fade-transition{/*定义动画过渡*/   transition:1s  all ease;}

        b: .fade-enter{/*定义进入动画  注意:进入离开最终一样*/}

        c:fade-leave{/*定义离开动画*/}

    html 如下:   

    <div id="wrap">
        <input type="button" value="按钮" @click="show">
        <div class="box" v-show='isShow'  transition='fade'></div>
    </div>

    .box{
      width:100px;
      height:100px;    
    }
    .fade-transition{ /*定义动画的过渡效果*/
      transition:1s all ease;  
    }
    .fade-enter{ /*进入动画*/
      opacity:0;  
    }
    .fade-leave{/*离开的动画*/
      opacity:0;
      transform:translate(200px)    
    }

    js

    var vm=new Vue({
      el:'#box',
      data:{
        isShow:true
      },
      methods:{
        show(){
          this.isShow=!this.isShow;
        }
      }
    });

    vue 1.0 结合animate.css定义动画

    页面记得引入animate.cdd

    html

    <div id="box2">
            <input type="button" value="按钮" @click='show'>
            <div id="div2"  class="animated"  v-show='isShow' transition="bounce">
            </div>
    </div>

    css

    #div2{
       width: 100px;
       height: 100px;
       background: red;
       margin: 50px auto;
    }

    js

    var vm2=new Vue({
           el:'#box2',
             data:{
                isShow:true,
             },
             methods:{
                 show(){
                      this.isShow=!this.isShow;
                 }
            },
           transitions:{
               bounce:{
                 enterClass:"zoomInLeft",
                 leaveClass:"zoomInRight"
               }
           }
     })
  • 相关阅读:
    Weather with you主题说明
    搜索枚举
    洛谷P2085——最小函数值
    洛谷P1402——乒乓球
    CSP2019,RP+=150。
    搜索之连通块(深搜广搜版)
    appium
    appium环境搭建
    Python抓取淘宝IP地址数据
    记录日志
  • 原文地址:https://www.cnblogs.com/junechen/p/9292059.html
Copyright © 2020-2023  润新知