微信小程序--退出小程序

微信小程序官方并没有提供退出的api。

但是提供了navigator这个组件

使用方法:

关闭按钮

组件地址:

https://developers.weixin.qq.com/miniprogram/dev/component/navigator.html

navigator中有一个属性open-type,这个是设置跳转方式的。我们看下open-type有哪些值


可以看到最后一个值。当设置open-type设置为exit时,必须要设置为target=’miniProgram’。注意: 这个是小程序版本库2.1.0之后才有的功能,所以要经常关注微信小程序文档更新。

你可能感兴趣的:(微信小程序--退出小程序)