vue 实现点击切换颜色
<template v-for="(value,index) in span_object"><span class="y_color_item1":key="value.color":style="{'background':value.color}" ...
·
<template v-for="(value,index) in span_object">
<span class="y_color_item1"
:key="value.color"
:style="{'background':value.color}"
@click="setChecked(index)"
>
<i :class="[ aa == index ? 'el-icon-check' : '']"></i>
</span>
</template>
setChecked(e){
this.aa = e
},
实现效果:
更多推荐
已为社区贡献4条内容
所有评论(0)