微信小程序用戶盒子、宮格列表的實現
更新時間:2020年07月01日 08:33:30 作者:換日線°
這篇文章主要介紹了微信小程序用戶盒子、宮格列表,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
最近在學習小程序,看到別人九宮格的做法,就留個筆記,也分享給大家
效果圖如下所示
.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; }
一些常見的盒子模型,直接復制粘貼就完了,簡潔明了
到此這篇關于微信小程序用戶盒子、宮格列表的實現的文章就介紹到這了,更多相關小程序用戶盒子、宮格列表內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
WebStorm啟動vue項目報錯代碼:1080?throw?err解決辦法
在使用webstorm新建vue項目時常會遇到一些報錯,下面這篇文章主要給大家介紹了關于WebStorm啟動vue項目報錯代碼:1080?throw?err的解決辦法,文中將解決辦法介紹的非常詳細,需要的朋友可以參考下2023-12-12vue路由警告:Duplicate named routes definition問題
這篇文章主要介紹了vue路由警告:Duplicate named routes definition問題及解決方案,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-09-09