search
HomeWeChat AppletMini Program DevelopmentDevelop 4 methods of page jumps in WeChat mini programs from scratch (6)

Usage: used for page jump, equivalent to the 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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool