收藏
回答

企业微信工作台ios左上角返回按钮进到其他页面监听不到

问题类型 API/组件名称 终端类型 微信版本 基础库版本
Bug wx.onHistoryBack 微信iOS客户端 3.1.12:6005 2.0.0
$.ajax({
        url: Sys_Server.server + '/sso/wechatParam',
        data:{
            url:location.href.split('#')[0]
        },
        async:false,
        success:function(res{
            console.log('res',res)
            wx.config({
                betatrue,// 必须这么写,否则wx.invoke调用形式的jsapi会有问题
                // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
                appId: res.data.appId, // 必填,企业微信的corpID
                timestamp: res.data.timestamp, // 必填,生成签名的时间戳
                nonceStr: res.data.noncestr, // 必填,生成签名的随机串
                signature: res.data.signature,// 必填,签名,见附录1
                jsApiList: ["onMenuShareAppMessage","onMenuShareWechat","onMenuShareTimeline","startRecord","stopRecord","onVoiceRecordEnd","playVoice","pauseVoice","stopVoice","onVoicePlayEnd","uploadVoice","downloadVoice","chooseImage","previewImage","uploadImage","downloadImage","getLocalImgData","previewFile","getNetworkType","onNetworkStatusChange","openLocation","getLocation","startAutoLBS","stopAutoLBS","onLocationChange","onHistoryBack","hideOptionMenu","showOptionMenu","hideMenuItems","showMenuItems","hideAllNonBaseMenuItem","showAllNonBaseMenuItem","closeWindow","openDefaultBrowser","scanQRCode","selectEnterpriseContact","openEnterpriseChat","chooseInvoice","selectExternalContact","getCurExternalContact","openUserProfile","shareAppMessage","shareWechatMessage","startWifi","stopWifi","connectWifi","getWifiList","onGetWifiList","onWifiConnected","getConnectedWifi","setClipboardData","getClipboardData"// 必填,需要使用的JS接口列表,所有JS接口列表见附录2
            })
        }
    })

    wx.ready(function(){
        console.log('ready成功')
        wx.onHistoryBack(function(){
            alert('监听到了')
            if(location.href.indexOf('wxWork/index.html') !== -1){
                alert(location.href)
                wx.closeWindow();
            }else {
                return true
            }
        });
    })
回答关注问题邀请回答
收藏
登录 后发表内容