vue 1.0 结合animate.css定义动画效果

时间:2021-05-26

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" } } })

总结

以上所述是小编给大家介绍的Vue 1.0自定义动画效果,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章