wxml文件
<view class="demo-page">
<view class="btn-group" wx:for="{
{list}}" wx:key="index">
<button class="mini-btn {
{item.isChecked ? 'active': ''}}" data-id="{
{item.id}}" data-index="{
{index}}"
data-isChecked="{
{item.isChecked}}" bindtap="selectFarmer" data-text="{
{item.type}}">{
{item.type}}
<iconfont name="iconduigou1" class="iconduigou1" wx:if="{
{item.isChecked}}"></iconfont>
</button>
</view>
</view>
js文件
Page({
data: {
name: [],
list: [{
id: 0,
type: 'aa',
isChecked: false
},
{
id: 1,
type: 'bb',
isChecked: false
},
{
id: 2,