Home  >  Article  >  WeChat Applet  >  How to implement Jiugongge jump in WeChat applet

How to implement Jiugongge jump in WeChat applet

藏色散人
藏色散人Original
2020-05-18 11:18:404924browse

How to implement Jiugongge jump in WeChat applet

How to implement Jiugongge jump in WeChat applet?

Rendering:

How to implement Jiugongge jump in WeChat applet

The red line in the rendering includes part of the nine-square grid effect, and comes with the item click time.

Related recommendations: " Mini Program Development Tutorial"

Specific implementation:

1. First add the image resource file

Create a new directory in the project root directory, named images, to store image resources, and then add a few pictures

How to implement Jiugongge jump in WeChat applet

2. Home.js file in the home directory Configure the data source in

How to implement Jiugongge jump in WeChat applet

The data source is an array, and each array element is an object. The object contains name (item text), img (item diagram), url (click the item to jump to the directory)

3. Program home.wxml based on the knowledge points of list rendering

① From the renderings, each item is surrounded by thin lines. This is the construction idea, an external view, draw the top border line

Outermost view style:

How to implement Jiugongge jump in WeChat applet

②. Draw each item in the external view For the border lines on the right and lower sides, the width of each item is set to 33.33333%, which means that three items are displayed equally in one line.

How to implement Jiugongge jump in WeChat applet

# ③. Each item contains a picture and a text, and the items can be clicked to jump to their respective designated pages

The navigation component is used here

The navigation component has an attribute url: the jump link in the current applet, specifying the page path to jump to when clicking on the component

Complete code:

home.wxml文件
 <view class="home_grids">
  <block wx:for="{{griddata}}" wx:key="item.name">
   <navigator url="../{{item.url}}/{{item.url}}" class=&#39;home_grid&#39;>
    <image src="{{item.img}}" class="home_icon"></image>
    <view class="home_grid_text">{{item.name}}</view>
   </navigator>
  </block>
 </view>

Home.wxss file

.home_grids {
   border-top: 1rpx solid #D9D9D9;
   overflow: hidden;
   margin-top: 10px
  }
  .home_grid{
   position: relative;
    float: left;
    padding: 20px 10px;
    width: 33.33333333%;
   box-sizing: border-box;
   border-right: 1rpx solid #D9D9D9;
   border-bottom: 1rpx solid #D9D9D9;
  }

The above is the detailed content of How to implement Jiugongge jump in WeChat applet. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn