动态class写法
两种动态class写法
:class="`showAi?'animate__animated animate__bounce':''`"
或者
:class="{cur:current==index}"//最简单写法
<template>
<view style="display: flex;justify-content: center;">
<image
:class="{'animate__animated animate__slideInDown':showAi}"
src="../../static/uni.png"
mode=""
style="width: 100px;height: 100px;"></image>
<button type="default" @click="beginAnimate"></button>
</view>
</template>
<script>
import "animate.css"
export default {
name: '',
data () {
return {
showAi:false
}
},
methods:{
beginAnimate(){
this.showAi=true
}
}
}
</script>
<style lang="less" scoped>
</style>
还没有评论,来说两句吧...