微信小程序点击强制退出


在微信小程序api中有这样一个组件

navigator: 页面链接

open-type string navigate 跳转方式

open-type 的合法值

说明 最低版本
navigate 对应 wx.navigateTo 或 wx.navigateToMiniProgram 的功能  
redirect 对应 wx.redirectTo 的功能  
switchTab 对应 wx.switchTab 的功能  
reLaunch 对应 wx.reLaunch 的功能 1.1.0
navigateBack 对应 wx.navigateBack 的功能 1.1.0
exit 退出小程序,target="miniProgram"时生效 2.1.0

上面是微信小程序官方给的文档

然后再来看我们的代码如何实现其实很简单就一行代码

    <navigator id="submitBtn" class="ui-btn" open-type="exit" target="miniProgram" style="left:100px;" bindtap="out" > 点此退出 </navigator>

只要在wxml中在的navigator中加上属性open-type="exit"并且需要加上 target="miniProgram"点击一下就会直接强制退出才会生效


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM