WeChat applet page jump and return and return data
WeChat applet explains page jump and return and returns data
A page:
.wxml file
<view class="flex-wrp"> <text style="width: 32%;">选择城市</text> <input style="width: 68%;" type="text" bindtap="city" placeholder="请选择城市" value="{{cityName}}"/> </view>
.js file
Page({ data: { cityName:"深圳" #用来回传的关键字,默认深圳 }, city: function(e){ wx.navigateTo({ url: '../city/city' }) } })
After page A jumps to page B, it returns:
cityNameClick: function (event) { var cityName = event.currentTarget.dataset.cityname; console.log(cityName); var pages = getCurrentPages(); var currPage = pages[pages.length - 1]; //当前页面 var prevPage = pages[pages.length - 2]; //上一个页面 //直接调用上一个页面的setData()方法,把数据存到上一个页面中去 prevPage.setData({ cityName: cityName }) wx.navigateBack(); },
Thank you for reading, I hope it can help everyone, thank you for your support of this site!
For more articles related to WeChat applet page jump and return and return data, please pay attention to the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
