当前位置:网站首页>微信小程序之点击取消,返回上页,修改上页的参数值,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 diagnosis service] i. diagnosis overview (2) - main diagnosis protocols (K-line and can)
记第一次使用阿里字体图标库
Initialization of classes and objects (constructors and destructors)
CUDA environment installation
[UDS unified diagnostic service] IV. typical diagnostic service (5) - function / component test function unit (routine function unit 0x31)
Installation of GCC, G + +, GDB
深蓝学院激光slam 理论与实践 第三章激光雷达去畸变 作业习题
JS高频面试题
[UDS unified diagnostic service] i. overview of diagnosis (4) - basic concepts and terms
Qt 添加QSerialPort类 实现串口操作
随机推荐
SDOI2009-HH的项链
Jeu de devinettes
[UDS unified diagnostic service] II. Network layer protocol (2) - data transmission rules (single frame and multi frame)
【UDS统一诊断服务】二、网络层协议(2)— 数据传输规则(单帧与多帧)
Declared as a global variable
函数的调用过程
Opencv uses genericindex for KNN search
WMI技术介绍和应用
搭建jpress个人博客
拷贝构造函数
基于Keras的时装分类案例
Introduction to nonparametric camera distortion model
浮点数双精度,单精度以及半精度知识总结
【UDS统一诊断服务】二、网络层协议(1)— 网络层概述与功能
FOC 单电阻采样 位置环控制伺服电机
C51/C52 特殊功能寄存器表
Round up a little detail of the round
基于TensorFlow的线性回归实例
Multibyte and Unicode in VS
Notes on advanced points of C language 2