vue 或 uniapp 点击图片或图标180度翻转
<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">&l
·
<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>
更多推荐
已为社区贡献4条内容
所有评论(0)