Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does WeChat Mini Programs realize the Nine Palace effect

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today, the editor will share with you the relevant knowledge about how WeChat Mini Programs can achieve the effect of the ninth palace grid. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

1. Sample diagram of the realization of Jiugong grid:

Tips: description:

Use display:-webkit-flex; to make the layout compatible.

Ensure the alignment of two pairs of three icons in each row, using the: justify-content: space-between; attribute.

The parent element must be wrapped by setting the flex-wrap: wrap; attribute, otherwise it will be displayed in a row.

The width of the child element width: 33.33333333%; allocated according to its occupancy size.

Use the justify-content:center; property to center the element.

Use the flex-direction: column; and flex-wrap: wrap; attributes to set the vertical arrangement of icon and text elements.

two。 Define the data source in the .js file:

Page ({/ * Page data Source * / data: {iconColor: ["red", "orange", "yellow", "green", "rgb (0255255)", "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 (0255255)"}, {"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. The styles are defined 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: # 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:

{{item.type}} above is all the contents of the article "how to achieve the Nine Palace effect by WeChat Mini Programs". Thank you for your reading. I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report