1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 微信小程序左上角返回按钮触发事件

微信小程序左上角返回按钮触发事件

时间:2019-04-05 16:53:10

相关推荐

微信小程序左上角返回按钮触发事件

从A页面跳转到B页面,再从B页面通过左上角返回按钮,返回到A页面

A页面:

B页面:

从B页面返回到A页面时,触发事件请求接口:

代码如下:

B页面js代码

onShow: function () {wx.setStorageSync('aShow', true)},

A页面js代码

onShow: function () {var page = this;let aShow = '';//获取存储信息wx.getStorage({key: 'aShow',success: function (res) {// successaShow = res.data;if (aShow) {// 学习进度app.sendRequest({url: api.course.study_plan,data: {curriculum_id: page.data.curriculum_id},success(plan_res) {if (JSON.stringify(plan_res.data) != "{}") {// 设置数据 page.setData({joined: 1,standard_id: plan_res.data.standard_id,standard_name: plan_res.data.standard_name,text: '继续学习'});} else {page.setData({standard_id: ''});}}});}}})},

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。