This article shares the specific code for the WeChat applet to achieve the nine-square grid effect for your reference. The specific content is as follows 1. Example diagram of Jiugongge implementation: Tips: Description: Use To ensure that the two pairs of three icons in each row The parent element must set The Use Use 2. Define the data source in the .js file: Page({ /** * Page data source */ data: { iconColor: [ 'red', 'orange', 'yellow', 'green', 'rgb(0,255,255)', 'blue', 'purple' ], iconStyle: [ { "type":"success", "size":30, "color":"#32CD32" }, { "type": "success_no_circle", "size": 30, "color": "orange" }, { "type": "info", "size": 30, "color": "yellow" }, { "type": "warn", "size": 30, "color": "green" }, { "type": "waiting", "size": 30, "color": "rgb(0,255,255)" }, { "type": "cancel", "size": 30, "color": "blue" }, { "type": "download", "size": 30, "color": "purple" }, { "type": "search", "size": 30, "color": "#C4C4C4" }, { "type": "clear", "size": 30, "color": "red" } ] } }) 3. Define the style in the .wxss file as follows: /* Nine-grid container layout style*/ .grid-item-container { display: -webkit-flex; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; border-top: 1rpx solid #D9D9D9; } /* Item container style*/ .grid-item-child { display:flex; display: -webkit-flex; justify-content:center; flex-direction: column; flex-wrap: wrap; float: left; width: 33.33333333%; height: 200rpx; box-sizing: border-box; background-color: #FFFFFF; border-right: 1rpx solid #D9D9D9; border-bottom: 1rpx solid #D9D9D9; } /* Icon style*/ .grid-item-icon { display:flex; display: -webkit-flex; justify-content:center; } /* Text style*/ .grid-item-label { display:flex; display: -webkit-flex; justify-content:center; color: #666; font-size: 14px; } 4. Specific use in .wxml files: <view class='grid-item-container'> <block wx:for="{{iconStyle}}" wx:key="index"> <view class='grid-item-child'> <view> <icon class='grid-item-icon' type='{{item.type}}' size='{{item.size}}' color='{{item.color}}'/> <text class='grid-item-label'>{{item.type}}</text> </view> </view> </block> </view> The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: How to upgrade all Python libraries in Ubuntu 18.04 at once
>>: Basic usage analysis of Explain, a magical tool for MySQL performance optimization
This article shares the specific code for JavaScr...
1. Install SVN server yum install subversion 2. C...
This article example shares the specific code of ...
Introduction: MySQL database recovery by time poi...
Performance of union all in MySQL 5.6 Part 1:MySQ...
Install Required Files Yum install openssl-* -y C...
After docker run, the status is always Exited Sol...
Querying the database SELECT * FROM `student` Que...
need Recently, we need to migrate Node online ser...
Table of contents 1. Introduction 2. Prepare the ...
Cause of failure Today, when I was writing a caro...
We often need to control the hidden, transparent ...
I plan to use C/C++ to implement basic data struc...
This article example shares the specific code of ...
A considerable number of websites use digital pagi...