小程序wxml页面:
<view>
   <button bindtap="clear">退出登录</button>
</view>小程序js页面
//清除缓存
 
 clear:function(){
    wx.clearStorageSync();//清除缓存
    wx.showToast({
       title: '退出登录成功',
       icon: 'none',
       duration: 2000,
       success: function () {
          setTimeout(function () {
             //跳转到首页,强制重启
             wx.reLaunch({
                url: '/pages/index/index',
             })
          }, 2000);
       }
    })
},
                    
                            
                            
5 comments
好的
你好
点赞
文章不错
123