当前位置:网站首页>微信小程序之点击取消,返回上页,修改上页的参数值,let pages=getCurrentPages() let prevPage=pages[pages.length - 2] // 上一页的数据
微信小程序之点击取消,返回上页,修改上页的参数值,let pages=getCurrentPages() let prevPage=pages[pages.length - 2] // 上一页的数据
2022-04-23 05:52:00 【幽幽靖】
实现功能:
个人中心:
待追访列表:
待追访详情页:
1.其他页面返回 个人中心页,需重新获取数据,更新页面内容;
2.待追访详情页,填写追访后,点返回,回到待追访列表,重新获取数据,更新待追访列表数据。
代码实现:
1.个人中心页:
<view class="iconbox" bindtap="daizhuifang">
<image class="iconimg" mode="widthFix" src="../../images/kehuxitong/xsicon04.png" />
<view class="icontxt">待追访</view>
<view class="daizhuikh" wx:if="{
{daizhuikh}}">{
{daizhuikh}}</view> <!-- 这里是显示的未读数字 -->
</view>
/** * 生命周期函数--监听页面显示 */
// onLoad页面加载时调用,可以获取参数,通过options。
// onShow页面显示时调用。
onShow: function() {
//页面显示就刷新一下更新数据;
// console.log(this.data.token);
// console.log(this.data.type);
wx.showLoading({
title: '加载中...',
mask: true,
})
this.getcard()
this.getCollectiondata()
this.gethistorydata()
if (this.data.type == 1) {
this.getmarketArticle(0)
this.getmarketArticle(1)
this.getmarketArticle(2)
this.getmarketArticle(3)
this.getmarketLoupanList()
// this.getgetUserInfo();
this.getgetCardIsStatus()
this.getgetMemberCount()
this.getsecondManageCount()
console.log('onshow')
// this.getgetManageUserList();
}
setTimeout(() => {
wx.hideLoading()
}, 500)
// if (this.data.token != '') {
// this.setData({
// token: false
// })
// }
},
2.待追访列表页:
/** * 生命周期函数--监听页面显示 */
onShow: function() {
wx.stopPullDownRefresh() //刷新完成后停止下拉刷新动效
this.getgetTagsList()
if (this.data.isaddkehu) {
// isaddkehu 参数为待追访详情页传过来的,如有值就更新页面,否则不更新列表页;
console.log('isaddkehu')
this.setData({
nomore: 0,
isLoadInterface: false,
pagecount: 1,
page: 1,
kehulistarr: [],
})
this.getgetManageUserList()
this.setData({
isaddkehu: false,
})
}
},
3.待追访详情页:
// 提交待追访后,执行
setTimeout(() => {
let pages = getCurrentPages() // 当前页的数据,
let prevPage = pages[pages.length - 2] // 上一页的数据
prevPage.setData({
isaddkehu: true, //修改上页参数值
})
// console.log(pages);
// wx.navigateBack({
// delta: 1
// })
}, 1000)
由此,在上页的 onShow 中判断这个 isaddkehu 参数值是否被修改了,就可以知道是否更新数据了。
版权声明
本文为[幽幽靖]所创,转载请带上原文链接,感谢
https://blog.csdn.net/ws19900201/article/details/111310181
边栏推荐
猜你喜欢
对象的动态建立和释放,赋值和复制
[UDS unified diagnostic service] i. overview of diagnosis (4) - basic concepts and terms
【UDS统一诊断服务】三、应用层协议(2)
基于TensorFlow的线性回归实例
Installation of GCC, G + +, GDB
[UDS unified diagnosis service] i. diagnosis overview (2) - main diagnosis protocols (K-line and can)
【UDS统一诊断服务】二、网络层协议(2)— 数据传输规则(单帧与多帧)
[UDS unified diagnostic service] IV. typical diagnostic service (5) - function / component test function unit (routine function unit 0x31)
For() loop parameter call order
Makefile基础、常用函数及通用Makefile
随机推荐
卷积神经网络实现CIFAR100数据集分类
Multibyte and Unicode in VS
客户端软件增量更新
Incremental update of client software
【UDS统一诊断服务】二、网络层协议(1)— 网络层概述与功能
基于VGG卷积神经网络的图像识别代码实现
For() loop parameter call order
记第一次使用阿里字体图标库
Shell脚本 单引号、双引号和反引号的区别
约瑟夫序列 线段树 O(nlogn)
TensorFlow张量介绍
[UDS unified diagnosis service] IV. typical diagnosis service (1) - diagnosis and communication management function unit
C语言进阶要点笔记2
圆整 round 的一点点小细节
WMI技术介绍和应用
Notes on advanced points of C language 2
Figure guessing game
Using printf in MFC
POJ-The Unique MST
token详解以及应用原理