search
HomeWeChat AppletMini Program DevelopmentWeChat applet example: four page jump methods (with code)

The content of this article is about WeChat applet examples: four page jump methods (with code), which has certain reference value. Friends in need can refer to it. I hope it will be helpful to you. help.

Usage: used for page jump, equivalent to the tag in html.
API tutorial: https://mp.weixin.qq.com/debug/wxadoc/dev/component/navigator.html
https://mp.weixin.qq.com/debug/wxadoc/dev/ api/ui-navigate.html

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

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

(Note that when 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">页面跳转,可以返回</navigator>
</view>

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

(Note that when the bottom navigation is not set, this attribute can also be used without tabs. With tabs Page needs to replace the switchTab attribute)

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

3: Open

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

<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 to the newly created folder no

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

4: Switch to page ta :

代码
<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, which are generally four main pages. , the jump between these main pages is like tab switching. These pages need to be configured separately in the tabBar. When a normal page jumps to these four main pages, the navigator cannot be used and switchTab is required.

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.

Related recommendations:

WeChat applet page jump function

WeChat How to monitor events when jumping between mini program pages

The above is the detailed content of WeChat applet example: four page jump methods (with code). 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

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)