search
HomeWeChat AppletMini Program DevelopmentHow to implement jump in WeChat applet? (Method introduction)

How to implement jump in WeChat applet? The following article will summarize for you several ways to implement jumps in WeChat mini programs. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to implement jump in WeChat applet? (Method introduction)

#1. Use navigation components, labels, and page links to achieve this (you can find that there is a background when clicking)

<!-- sample.wxml -->
<view class="btn-area">
  <navigator url="../my/my">跳转到新页面</navigator>
</view>

The parameters are as follows

How to implement jump in WeChat applet? (Method introduction)

#2. Add a listener for the bindtap event to the page layout, and then in the method, use wx.navigatorTo to implement the jump (retain the current page and jump to the application A certain page within the page, use wx.navigateBack to return to the original page)

Add monitoring bindtap event in my.wxml

<view bindtap=&#39;jump&#39;>跳转</view>

Realize jump in my.js

  jump:function(){
    wx.navigateTo({
      url: &#39;../login/login&#39;,
      success: function(res) {

      },
      fail: function(res) {

      },
      complete: function(res) {

      },
    })
  }

The parameters are as follows

How to implement jump in WeChat applet? (Method introduction)

3. Jump through wx.redirectTo (close the current page and jump to a page in the application)

navigateto_index: function (event) { 
 wx.redirectTo({ 
 url: &#39;../index/index&#39;, 
 success: function (res) { 
 // success 
 }, 
 fail: function () { 
 // fail 
 }, 
 complete: function () { 
 // complete 
 } 
 }) 

 }

The parameters are as follows

How to implement jump in WeChat applet? (Method introduction)

#4. Return to the previous level through wx.navigateBack (close the current page. Return to the previous page or more level page).

wx.navigateBack({ 
  delta: 1, // 回退前 delta(默认为1) 页面 
  success: function (res) { 
  // success 
  }, 
  fail: function () { 
  // fail 
  }, 
  complete: function () { 
  // complete 
  } 
 })

How to implement jump in WeChat applet? (Method introduction)

Recommended: "小program Development Tutorial"

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

Statement
This article is reproduced at:csdn. If there is any infringement, please contact admin@php.cn delete

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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

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

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.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),