法一:

参考自你追我如果你追到我…我就…

<navigator open-type="exit" target="miniProgram">退出</navigator>


法二:

摘自简书ThinkinLiu,推荐大家去看原作者的文章。

微信小程序API内是不提供关闭小程序的按钮的,但是我们可以通过页面跳转的方式,关闭微信小程序。

小程序

test.wxml:

<view><view bindtap="close">关闭</view></view>

test.js:

close: function(e){    // @simorel    // 2018年8月6日 10点21分    // 跳转至 check 页面,带着参数 finish 为true    wx.navigateTo({ url: 'check?finish=true' });}/*** 生命周期函数--监听页面加载*/onLoad: function(options) {    // @simorel    // 2018年8月6日 10点22分    // 退出微信小程序    if (options.finish) {      wx.navigateBack({ delta: 1 })    }}小程序

TAG标签: 微信小程序微信小程序怎么关闭

http://www.xiaochengxub.com/read-106479.html