1 回答
TA贡献1893条经验 获得超10个赞
css做旋转动画
新建一个data 比如叫 rotate:false
然后用三目运算绑定class,v-bind:class=[rotate=true?'class a':'class b']
然后点击让rotate发生改变
这样应该可以实现的
<style scoped>
.aa{
transition: all 2s;
}
.go{
transform:rotate(-180deg);
transition: all 2s;
}
</style>
<template>
<div>
<i :class="[rotate?'fa fa-arrow-down go':'fa fa-arrow-down aa']" @click="start"></i> //class随rotate的true或者false改变 我这为图方便用了项目里的图标测试,图片也是一样的~
</div>
</template>
<script>
export default {
data () {
return {
rotate:false
}
},
methods: {
start(){
this.rotate=!this.rotate;
console.log(this.rotate)
}
}
}
</script>
添加回答
举报
