微信小程序:flex布局实现换行

1、关键代码.wxml:

<view class="pay margin-top-40">
    <view class="info">
      <view class="pay-info-title margin-left-22 flex-start"> 请选择充值金额</view>

      <view class="flex-wrap margin-top-20">
        <view class="pay-item-select flex-center margin-left-22">
          <view class="pay-item-detail flex-center">
            <view>
              <view class="pay-item-detail-top flex-start">
                <view class="pay-jbi flex-center">
                  <image src="https://images.xxx.com/my_pay_jinbi.png" />
                </view>
                <view class="pay-item-detail-top-money flex-center">80</view>
              </view>
              <view>¥ 80.00</view>
            </view>
          </view>
        </view>

        <view class="pay-item flex-center margin-left-22">
          <view class="pay-item-detail flex-center">
            <view>
              <view class="pay-item-detail-top flex-start">
                <view class="pay-jbi flex-center">
                  <image src="https:/images.xxx.com/my_pay_jinbi.png" />
                </view>
                <view class="pay-item-detail-top-money flex-center">80</view>
              </view>
              <view>¥ 80.00</view>
            </view>
          </view>
        </view>

        <view class="pay-item flex-center margin-left-22">
          <view class="pay-item-detail flex-center">
            <view>
              <view class="pay-item-detail-top flex-start">
                <view class="pay-jbi flex-center">
                  <image src="https://images.xxx.com/my_pay_jinbi.png" />
                </view>
                <view class="pay-item-detail-top-money flex-center">80</view>
              </view>
              <view>¥ 80.00</view>
            </view>
          </view>
        </view>

        <view class="pay-item flex-center margin-left-22">
          <view class="pay-item-detail flex-center">
            <view>
              <view class="pay-item-detail-top flex-start">
                <view class="pay-jbi flex-center">
                  <image src="https://images.xxxx.com/my_pay_jinbi.png" />
                </view>
                <view class="pay-item-detail-top-money flex-center">80</view>
              </view>
              <view>¥ 80.00</view>
            </view>
          </view>
        </view>

        <view class="pay-item flex-center margin-left-22">
          <view class="pay-item-detail flex-center">
            <view>
              <view class="pay-item-detail-top flex-start">
                <view class="pay-jbi flex-center">
                  <image src="https://images.xxx.com/my_pay_jinbi.png" />
                </view>
                <view class="pay-item-detail-top-money flex-center">80</view>
              </view>
              <view>¥ 80.00</view>
            </view>
          </view>
        </view>

        <view class="pay-item flex-center margin-left-22">
          <view class="pay-item-detail flex-center">
            <view>
              <van-cell-group>
                <van-field type="number" maxlength='6' clearable custom-style="background-color: #F9F9F9;" placeholder="其它金额" input-align="center" bind:change="onChange" />
              </van-cell-group>
            </view>
          </view>
        </view>

      </view>
    </view>
  </view>

2、关键代码.wxss:

/* 实现换行 */
.flex-wrap {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
}

.pay .pay-item {
  width: 220rpx;
  height: 140rpx;
  background: #F9F9F9;
  border-radius: 20rpx;
  border: 2rpx solid #E9E9E9;
  margin-top: 20rpx;
}

.pay .pay-item-select{
  width: 220rpx;
  height: 140rpx;
  border:3rpx solid #FF5000;
  border-radius: 20rpx;
  background: #FFF6EE;
  margin-top: 20rpx;
}

.pay .pay-item-detail .pay-input{
  background-color: #F9F9F9;
}

效果:

相关推荐
Kika写代码3 小时前
【微信小程序】页面跳转基础 | 我的咖啡店-综合实训
服务器·微信小程序·小程序
源码哥_博纳软云4 小时前
JAVA同城服务场馆门店预约系统支持H5小程序APP源码
java·开发语言·微信小程序·小程序·微信公众平台
禾高网络4 小时前
租赁小程序成品|租赁系统搭建核心功能
java·人工智能·小程序
YUJIAN。6 小时前
使用uniapp开发微信小程序-框架搭建
微信小程序·小程序·uni-app
关你西红柿子7 小时前
小程序app封装公用顶部筛选区uv-drop-down
前端·javascript·vue.js·小程序·uv
V+zmm101347 小时前
基于小程序宿舍报修系统的设计与实现ssm+论文源码调试讲解
java·小程序·毕业设计·mvc·ssm
V+zmm1013414 小时前
基于微信小程序的乡村政务服务系统springboot+论文源码调试讲解
java·微信小程序·小程序·毕业设计·ssm
还这么多错误?!14 小时前
uniapp微信小程序,使用fastadmin完成一个一键获取微信手机号的功能
微信小程序·小程序·uni-app
_院长大人_14 小时前
微信小程序用户信息解密 AES/CBC/NoPadding 解密失败问题
微信小程序·小程序
web1350858863515 小时前
uniapp小程序使用webview 嵌套 vue 项目
vue.js·小程序·uni-app