<style lang="css" scoped>
.aa{
transition: all 2s;
}
.go{
transform:rotate(-180deg);
transition: all 2s;
}
</style>
<template>
<div>
<i :class="[rotate?'go':'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>
原文地址:https://blog.csdn.net/wangongchao/article/details/112522381
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。