uniapp 小程序 APP 退出应用

APP端:

if (uni.getSystemInfoSync().platform == 'ios'){
    plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
} else if (uni.getSystemInfoSync().platform == 'android'){
    plus.runtime.quit();
}

小程序(按钮形式):

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

小程序(js):

//在需要退出小程序的地方调用添加下面代码即可(js文件中)
                wx.exitMiniProgram({
                    success: (res) => {}
                })

 

posted @ 2022-09-07 17:15  脆脆啥  阅读(2354)  评论(0)    收藏  举报