微信想实现左上角退出的二次确认,就是用户点击退出后询问用户是否退出这种,应该怎么实现呢?

小程序 文章 2022-04-28 19:40 915 0 全屏看文

AI助手支持GPT4.0

微信想实现左上角退出的二次确认,就是用户点击退出后询问用户是否退出这种,应该怎么实现呢?WeChat wants to realize the second confirmation of exit in the upper left corner, that is, after the user clicks to exit, it asks the user whether to exit. How should it be implemented?

微信想实现左上角退出的二次确认,就是用户点击退出后询问用户是否退出这种,应该怎么实现呢?

我看社区有说没有这个退出的接口,但是如果想实现这个功能有没有其他方案呢?

I think the community has said that there is no exit interface, but if you want to realize this function, is there any other scheme?

回答:

跨商通:

1、普通小程序页:自定义导航栏;但是毫无意义,因为不能阻止手势后退,比如右滑。

2、webview页:无法实现。

订阅happiness:

退出的api是小程序的。不是h5的。还有就是退出的 api 没法阻止左滑返回。h5的 你试试 window.close的时候alert

https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.enableAlertBeforeUnload.html

宗介哦:可是微信浏览器左上角的的叉叉是退出,也可以监听到吗,我搜了好多地方说不行。
https://www.zhihu.com/question/53159120
小黎:

退出小程序?左上角?

宗介哦:H5页面,左上角退出

-EOF-

AI助手支持GPT4.0