在详情页点赞后,点赞数+1,回到列表页,怎样让列表中的点赞数也+1呢?

小程序 文章 2021-01-23 17:01 486 0 全屏看文

AI助手支持GPT4.0

在详情页点赞后,点赞数+1,回到列表页,怎样让列表中的点赞数也+1呢?After liking the details page, the number of likes is +1, and returning to the list page, how to make the number of likes in the list also +1?

在详情页点赞后,点赞数+1,回到列表页,怎样让列表中的点赞数也+1呢?

在详情页点赞后,点赞数+1,回到列表页,怎样让列表中的点赞数也+1呢?


After you click like on the details page, the number of likes will be + 1. Back to the list page, how can you make the number of likes in the list also + 1?

回答:

张老师:什么的详情页呢?公众号?还是小程序开发?
跨商通:

在详情页里调用列表页里的函数。三种方法:

1、详情页里wx.getCurrentPages获得列表页引用;

2、列表页里wx.navigateTo({events:{callback:e=>{xxx}}})

3、详情页onHide的时候设置globalData,列表页onShow里setData

差不多就这些了。

this:

自定义事件,点赞后触发这个事件,使列表中的点赞也增加

-EOF-

AI助手支持GPT4.0