<style lang="css" scoped>
.a{
transition: all 2s;
}
.g{
transform:rotate(-180deg);
transition: all 2s;
}
</style>
<template>
<div>
<a-icon type="up" :class="[state?'g':'a']" @click="Change"/> //class随state的true或者false改变
</div>
</template>
<script>
export default {
data () {
return {
state:false
}
},
methods: {
Change(){
this.state=!this.state;
console.log(this.state)
}
}
}
</script>
vue 点击图标旋转
于 2022-03-07 11:41:41 首次发布