页面:
<template>
<view @click="test" >
<test :clicked="clicked==='qqq'" data-type="qqq"></test>
</view>
</template>
<script>
export default {
data() {
return {
clicked:'qqq'
};
},
methods:{
test(e){
const{
type,value
}=e.target.dataset
this.clicked=this.clicked==type?"":type
console.log(e.target.dataset)
}
}
}
</script>
<style lang="scss">
</style>
test组件:
<template>
<view class="test editor-icon" :class="clicked?`clicked icon-bold`:`icon-bold`" @click="click" @tap="click">
</view>
</template>
<script>
export default {
props: {
clicked: Boolean
},
data() {
return {};
},
methods:{
click(e){
console.log(e.target.dataset)
this.$emit('click',e)
}
}
}
</script>
<style lang="scss">
@import "../sve-icon/editor-icon.css";
.test {
background-color: #fff000;
width: 100rpx;
height: 100rpx;
}
.clicked {
background-color: #000000;
}
</style>
8***@qq.com
请问你们修复到哪里了? 我3.1.22还是一样有问题
2021-07-27 17:57
DCloud_UNI_GSQ
回复 8***@qq.com: 你遇到的问题可能只是相近,并非相同,请具体描述一下
2021-08-02 11:43