当前位置:网站首页>Wechat applet returns parameters or trigger events
Wechat applet returns parameters or trigger events
2022-07-24 05:39:00 【XIE392】
Application scenarios
Click Select to jump to a new page , Select successfully on the new page and return to the previous page , Render the selected results to the previous page .
Problem description
Return to the previous page in wechat applet API yes wx.navigateBack , This with wx.navigateTo Somewhat different , The former does not url Provide return and carry parameters , The latter can be found in url Carry the parameters and jump . So how to return to the previous page with parameters ?
resolvent
Example :A Parent page ,B Is a subpage ,B The page needs to return with parameters A page
A page
Page({
data: {
name:" Zhang San "
},
test(){
console.log("A page ");
}
})
B page
let pages = getCurrentPages(); // Get the current page stack
let prevPage = pages[pages.length - 2];
prevPage.setData({
name: " Li Si " // Value to be passed
})
prevPage.test(); // call A Page method Output :A page
wx.navigateBack({
delta:1 // Return to the previous page
})
result (A page ):
Page({
data: {
name:" Zhang San "
},
test(){
console.log("A page ");
}
onShow(){
console.log("this.data.name"); // Li Si
}
})
边栏推荐
猜你喜欢

首届波卡黑客松项目「Manta Network」的进击之路
![利用流媒体将RSTP流转成WEB端播放(二)[可回看]](/img/b9/2c0e6eb19acaa2356ff49f6e272826.png)
利用流媒体将RSTP流转成WEB端播放(二)[可回看]

Analysis of Dao liquidity dual currency pledge mining development principle

Insanity:1 (insanity hosting) target penetration vulnhub

vulnhub-SolidState: 1靶机渗透测试

canvas - 旋转

Tree structure + node

自定义MVC 1.0

grid布局

Mapboxgl + GeoServer configuration local map tutorial
随机推荐
Three -- orbitcontrols track controller
jsp标签
Promise_ Async and await
Station B video comment crawling - take the blade of ghost destruction as an example (and store it in CSV)
canvas - 填充
B站视频评论爬取——以鬼灭之刃为例(并将其存储到csv中)
C document reading and writing plus linked list addition, deletion, modification and query
登录 页面 + 总结心得
@Async 没有异步执行
PoS机制随机性解读,波卡的随机性原理如何运作?
highcharts使用自定义矢量地图
Web3 Foundation grant program empowers developers to review four successful projects
自定义MVC 2.0
Principle of fusdt liquidity pledge mining development logic system
去中心化的底层是共识——Polkadot 混合共识机制解读
公链Sui Layer1网络
Mobile software development ISO simple wechat
Analysis of Dao liquidity dual currency pledge mining development principle
Keywords_ 01return
Interpretation of the randomness of POS mechanism, how does poca's randomness principle work?