wx.logout

查看 Markdown

最后一次编辑于 2026-03-12

清空系统登录态。登出后,将无法通过调用 wx.getMiniProgramCode、wx.getIdentityCode 获得登录凭证。

参数

Object object

属性 类型 默认值 必填 说明
success function 否 接口调用成功的回调函数
fail function 否 接口调用失败的回调函数
complete function 否 接口调用结束的回调函数

object.fail 回调函数

参数
Object res
属性 类型 说明
errCode number 错误码
errMsg string 错误提示

res.errCode

errCode 说明
-1 system error

示例代码

wx.logout({
  success () {
      console.log('已登出')
  }
})