动态引入https://res.wx.qq.com/open/js/jweixin-1.2.0.js可以 动态引入https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js苹果第二次进入会报错,异步等情况尝试过,不知道是什么原因
当是企业微信环境时,动态插入jwxwork-1.0.0.js,ios侧边栏第二次进入会报错我们的h5应用需要根据环境动态插入js-sdk,按目前文档企业微信插入1.2,微信插入1.6。 当是企业微信环境时,动态插入https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js,ios第二次进入会报错 [图片] 用script引入不会报错<script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script> // 根据环境插入不同js-sdk,按目前文档企业微信插入1.2,微信插入1.6 if (getEnv() === 1) { const script = document.createElement('script'); script.crossorigin = 'anonymous'; script.src = 'https://res.wx.qq.com/open/js/jweixin-1.2.0.js'; document.head.appendChild(script); // ios第二次进入会报错,先注释 const script2 = document.createElement('script'); script2.crossorigin = 'anonymous'; script2.src = 'https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js'; document.head.appendChild(script2); } else { const script = document.createElement('script'); script.crossorigin = 'anonymous'; script.src = 'https://res.wx.qq.com/open/js/jweixin-1.6.0.js'; document.head.appendChild(script); }
2021-03-01