Home  >  Article  >  WeChat Applet  >  Develop 4 methods of page jumps in WeChat mini programs from scratch (6)

Develop 4 methods of page jumps in WeChat mini programs from scratch (6)

小云云
小云云Original
2018-05-11 16:54:083363browse

Usage: used for page jump, equivalent to the 3499910bf9dac5ae3c52d5ede73834855db79b134e9f6b82c0b36e0489ee08ed tag in html. This article mainly shares with you four methods of page jumps in developing WeChat mini programs from scratch (6). I hope it can help you.

Four jump methods, write a piece of code in the index for testing

1: Jump from the homepage to the log page (you can return)

(Note, When there is no bottom navigation set, this attribute can also be used without tabs. If there is a tab page, the switchTab attribute needs to be replaced)

<view>
    <navigator  url="/pages/logs/logs" hover-class="changestyle">页面跳转,可以返回</navigator></view>

2: Jump from the home page to the log page (cannot return)

(Note that if the bottom navigation is not set, this attribute can be used without tabs. If there is a tab page, the switchTab attribute needs to be replaced)

<view>
    <navigator  url="/pages/logs/logs" hover-class="changestyle" redirect>页面跳转,无法返回</navigator></view>

#3: Open

on the current page and create a new folder, name it no, complete the wxml test information inside, and fill in the content at will to facilitate testing

<view class="btn-area">  
   <navigator url="/pages/test/test" hover-class="navigator-hover">我是一个自由分散的页面哦</navigator>  
 </view>

Open the global app.json file and write the path of the newly created folder no into the

picture. png.

We now want to test opening from the link on the home page. Click the link to open the no page on the current home page.

4: Switch to tab page:

代码<view><navigator url="/pages/logs/logs" open-type="switchTab" hover-class="other-navigator-hover">切换 Tab</navigator></view>
Note: The jump I use here is switchTab jump, not navigator

Reason: All page paths need to be configured in the tabBar under pages. There are generally four main pages. The jumps between these main pages are like tab switching. These pages need to be configured separately in the tabBar. Ordinary pages go here. When jumping to the four main pages, navigator cannot be used and switchTab must be used.

Experience summary: When configuring the pagePath of the list item in the TabBar, try not to use it as a jump link to other pages.

The above is the detailed content of Develop 4 methods of page jumps in WeChat mini programs from scratch (6). 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