自己已经解决,在这里备注一下
在应用 onLaunch 钩子中手动加载 js-sdk 重写覆盖掉 uni 自带的 window.wx 这样就可以愉快的在H5端正常的使用 sdk 的内容啦
只适用于H5端
addScript() {
const that = this
window.wx = null
const script1 = document.createElement('script')
script1.type = 'text/javascript'
script1.src= 'https://res.wx.qq.com/open/js/jweixin-1.2.0.js'
document.head.appendChild(script1)
script1.onload = function() {
const script2 = document.createElement('script')
script2.type = 'text/javascript'
script2.src= 'https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js'
document.head.appendChild(script2)
script2.onload = function() {
// TODO something
}
}
}