小程序返回app的同时能不能关闭小程序?

小程序 文章 2021-12-29 10:20 606 0 全屏看文

AI助手支持GPT4.0

小程序返回app的同时能不能关闭小程序?Can the applet be closed when the applet returns to the app?

小程序返回app的同时能不能关闭小程序?

现在有这个需求,app打开小程序没问题,小程序返回app也没问题,问题是就想在小程序返回app的时候把小程序也关闭掉,这里面涉及到两个官方的东西

<button  app-parameter="WeChat" open-type="launchApp" binderror="launchAppError" >返回APP</button><navigator open-type="exit" target="miniProgram">退出小程序</navigator>


Now there is this requirement. There is no problem opening the app and returning the app. The problem is that you want to close the applet when it returns to the app, This involves two official things < button app parameter = "wechat" open type = "launchapp" binder = "launchapperror" > return app < / button > < navigator open type = "exit" target = "miniprogram" > Exit applet < / navigator >

回答:

微盟:

触发返回app的事件可以用 wx.exitMiniProgram 方法,但是必须要有需要有点击事件

如果是系统行为则目前没有好的方式

好好学习:感谢你的回答,就是说目前只能二选一吗?有没有一些比较好的方案呢
草帽男孩:

退出小程序需要客户点击按钮主动触发,系统自带的返回键是无法做到退出的

好好学习:感谢你的回答,就是说目前只能二选一吗?有没有一些比较好的方案呢

-EOF-

AI助手支持GPT4.0