<view class='bg-gray'>
<view class='main'>
<text>选择充值金额</text>
<view class='flex between itemBox'>
<view class="{{rechangeActiveIndex == index ? 'active':''}}" wx:for="{{rechangeNumArray}}" wx:key="{{index}}" bindtap='activethis' data-thisindex='{{index}}'><div>¥{{item}}</div></view>
</view>
</view>
.itemBox{
display: flex;
flex-flow: wrap;
}
.itemBox view{
width: 33.3%;
box-sizing: border-box;
margin: 5% auto;
}
.itemBox view>div{
text-align: center;
padding: 20rpx;
margin: 10%;
border-radius: 8rpx;
background: #eff4f8;
border: 2rpx solid white;
color: black;
font-size: 40rpx;
}
.itemBox view.active>div{
background: #22a6e4;
border: 2rpx solid #5cbcfe;
color: white;
font-weight: bold;
有两个背景宽度比其他的短,怎么能统一宽度呢
}
因为没有设置宽度,除非所有内容的长度是一致的就可以不用设置宽度就能保持一致
<view class="{{rechangeActiveIndex == index ? 'active':''}}" wx:for="{{rechangeNumArray}}" wx:key="{{index}}" bindtap='activethis' data-thisindex='{{index}}'><div>¥{{item}}</div></view>
</view>
css设置宽度啊
<view class="{{rechangeActiveIndex == index ? 'active':''}}" wx:for="{{rechangeNumArray}}" wx:key="{{index}}" bindtap='activethis' data-thisindex='{{index}}'><div>¥{{item}}</div></view>
</view>