<scroll-view scroll-x="{{ true }}" enable-flex="{{ true }}">
<view wx:for="{{ typeList }}" wx:key="id">{{ item.name }}</view>
</scroll-view>
scroll-view {
display: flex;
height: 100rpx;
justify-content: space-between;
background-color:red;
}
view {
line-height: 100rpx;
}
换一种布局方式
<scroll-view scroll-x="{{ true }}">
<view class="scrollBox">
<view wx:for="{{ typeList }}" wx:key="id">{{ item.name }}</view>
</view>
</scroll-view>
scroll-view {
background-color: red;
padding: 0 30rpx;
box-sizing: border-box;
}
.scrollBox {
display: flex;
white-space: nowrap;
gap: 30rpx;
height: 80rpx;
align-items: center;
}