当前页面无法刷新,只能使用下拉刷新进行刷新数据?

小程序 文章 2022-03-11 11:40 302 0 全屏看文

AI助手支持GPT4.0

当前页面无法刷新,只能使用下拉刷新进行刷新数据?The current page cannot be refreshed, and can only use pull-down refresh to refresh data?

当前页面无法刷新,只能使用下拉刷新进行刷新数据?

在开发中遇到一个问题,就是在删除后想要刷新当前页面,以获得最新的数据显示,我调用了数据初始化方法(内含setData),还有this.onLoad,this.Show等方法都无效,只有下拉刷新页面才会生效。但是同样的功能同样的结构在另一个页面就可以直接使用数据初始化方法实现。求解答

A problem encountered in the development is that I want to refresh the current page after deletion to obtain the latest data display. I called the data initialization method (including SetData) and this onLoad,this. Show and other methods are invalid. Only the drop-down refresh page will take effect. However, the same function and the same structure can be realized directly using the data initialization method on another page. Find a solution

回答:

光:

你可以创建一个自定义函数 作为初始化函数呀,onshow 调用你这个自定义函数 然后需要刷新 在次调用不久好了?


小黎:

同样的功能,确定一样么?再仔细看看呢

z:
z:抱歉哈我语言组织有点差,大概意思就是,有两个页面A和B,都需要在删除某个信息后,重新渲染页面,或是重新获取数据来拿到最新的。在A页面删除成功后调用这个getAllList方法,可以重新渲染数据,但是同样的业务逻辑和操作在B页面却毫无效果。
brave:方便的话创建个代码片段  https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html 这边看下
z:在B页面用网上说的this.Onload和this.Onshow都无效(这两个生命周期内我是写了数据初始化函数调用的),只有使用下拉刷新才可以生效

-EOF-

AI助手支持GPT4.0