How to jump to the WeChat applet page (with code)

不言
Release: 2018-08-10 15:03:18
Original
8302 people have browsed it

The content of this article is about the method of page jump of WeChat applet (with code). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

I am currently working on the WeChat Xiaocheng project, and I will summarize all the problems I encountered.
Summary of the WeChat applet jump page method (I hope you will correct me if there are any mistakes)

API method provided by WeChat applet

// 保留当前页面,跳转到应用的某个页面,点击返回按钮时还可以返回原来页面wx.navigateTo({
    url: '文件地址',    地址后面也可以追加参数  'page/index/index?id=123&page=2'})
Copy after login
// 关闭当前页面,跳转到应用内的某个页面。  点击返回按钮时不会返回原来页面wx.redirectTo({
    url: 'page/index/index?id=123&page=2'})
Copy after login
// 关闭所有页面,打开到应用内的某个页面。wx.reLanch({
  url: 'page/index/index?id=123&page=2'})
Copy after login
// 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面// 注意:必须是在app.json中注册过的tabBar 页面wx.switchTab({
    url: 'page/index/index'})
Copy after login

navigator in the component

<view class="btn-area">
  <navigator url="/page/navigate/navigate?title=navigate" hover-class="navigator-hover">跳转到新页面</navigator>
  <navigator url="../../redirect/redirect/redirect?title=redirect" open-type="redirect" hover-class="other-navigator-hover">在当前页打开</navigator>
  <navigator url="/page/index/index" open-type="switchTab" hover-class="other-navigator-hover">切换 Tab</navigator>
  <navigator target="miniProgram" open-type="navigate" app-id="" path="" extra-data="" version="release">打开绑定的小程序</navigator>
</view>

url: 当前小程序内跳转链接open-type: 跳转方式(上面api提供的四中方法)delta: 当 open-type 为 &#39;navigateBack&#39; 时有效,表示回退的层数hover-class: 指定点击时的样式类,当hover-class="none"时,没有点击态效果
Copy after login

Jump external links

When jumping external links, you need to pay attention to log in to the WeChat applet
Configure the request legal domain name to jump to the past

How to jump to the WeChat applet page (with code)

<web-view src="https://baidu.com/"></web-view>
Copy after login

Related recommendations:

Solution to the bug in WeChat Mini Program: Solution to the problem that the page cannot be rendered normally in iOS9.X using flex layout

WeChat Mini Program The program realizes the number of products that can be purchased during shopping (with code)

WeChat applet example: realizes the effect of the navigation bar moving with the top tab switching and sliding switching (code)

The above is the detailed content of How to jump to the WeChat applet page (with code). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template