微信小程序用户盒子、宫格列表的如何实现

我们永远不能怪罪任何帮了倒忙的志愿者。他们是一心对你好,别让他们心凉。相信自已。不要妄加评判自已,也不会把自已交给别人评判,更不会贬低自已。

最近在学习小程序,看到别人九宫格的做法,就留个笔记,也分享给大家

效果图如下所示

.wxml

<view class='user-box' style="margin-top:20rpx;">
  <view class='ctn'>
    <view class='list' wx:for="{{4}}" wx:key data-index="{{index}}">
      <image mode="widthFix" src='/images/dfk.png'></image>
      <text>退换/售后</text>
      <view>查看明细</view>
    </view>
  </view>
</view>

<view class='user-box' style="margin-top:20rpx;">
  <view class='ctn'>
    <view class='list' wx:for="{{4}}" wx:key data-index="{{index}}">
      <image mode="widthFix" src='/images/dfk.png'></image>
      <text>退换/售后</text>
    </view>
  </view>
</view>

<view class='user-box' style="margin-top:20rpx;">
  <view class='ctn cuin'>
   <view class='list' wx:for="{{6}}" wx:key data-index="{{index}}" style="width:33.33%;">
    <image mode="widthFix" src='/images/dfk.png'></image>
    <text>退换/售后</text>
   </view>
  </view>
</view>

<view class='user-box' style="margin-top:20rpx;">
  <view class='ctn'>
    <view class='list' wx:for="{{4}}" wx:key data-index="{{index}}" style="padding:10rpx 0 20rpx 0;">
      <image style="position:relative;top:10rpx" mode="widthFix" src='/images/dfk.png'></image>
      <text style="border-right:1px solid #ddd;">退换/售后</text>
      <view>查看明细</view>
    </view>
  </view>
</view>

<view class='user-box' style="margin-top:20rpx;">
  <view class='ctn'>
    <view class='list' wx:for="{{4}}" wx:key data-index="{{index}}">
      <span class="user-span">99+</span>
      <image mode="widthFix" class="user-image" src='/images/dfk.png'></image>
      <text>退换/售后</text>
    </view>
  </view>
</view>

.wxss

page{
 background-color: #f7f7f7;
}
view{
 box-sizing: border-box;
}
.user-box{ width: 100%;float: left;overflow: hidden;background-color: #fff; }
.user-box .ctn{ display: flex;justify-content:flex-start;align-items: center;flex-wrap:wrap;}
.user-box .ctn .list{ text-align: center; width: 25%; padding:20rpx 0 20rpx 0; position: relative;}
.user-box .ctn .list image{ width: 50rpx; height: auto;}
.user-box .ctn .list text{ display: block; font-size: 24rpx; padding-top: 10rpx;} 
.user-box .ctn .list view{font-size: 16rpx;color: #ccc;position: relative;top: 4rpx;}

.cuin view:nth-child(6){
 border-top: 1px solid #ddd;
}
.cuin view:nth-child(5){
 border-right: 1px solid #ddd;
 border-top: 1px solid #ddd;
}
.cuin view:nth-child(4){
 border-right: 1px solid #ddd;
 border-top: 1px solid #ddd;
 position: relative;
}
.cuin view:nth-child(2){
 border-right: 1px solid #ddd;
}
.cuin view:nth-child(1){
 border-right: 1px solid #ddd;
}

.user-span{
 font-size: 18rpx;
 height: 28rpx;
 display: flex;
 align-items: center;
 background-color: #e54d42;
 color: #fff;
 padding: 0 8rpx 4rpx 10rpx;
 border-radius: 200rpx;
 position: absolute;
 top: 10rpx;
 right: 20rpx;
}

一些常见的盒子模型,直接复制粘贴就完了,简洁明了

到此这篇关于微信小程序用户盒子、宫格列表的实现的文章就介绍到这了,更多相关小程序用户盒子、宫格列表内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!

标签: 小程序 实现