Skip to content

Commit

Permalink
fix(Wechat): autoLoadJSSDK 默认为 true
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed May 22, 2019
1 parent 13459ec commit 4e89734
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/Wechat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,22 +253,26 @@ export class Wechat {
this.bus.emit('error', err)
})
}
if (params.autoLoadJSSDK) {
loadResource({
type: LoadResourceUrlType.js,
path: 'https://res.wx.qq.com/open/js/jweixin-1.4.0.js',
alternatePath: 'https://res2.wx.qq.com/open/js/jweixin-1.4.0.js',
}).then(() => {
if (typeof wx !== 'undefined') {
config()
} else {
if (params.autoLoadJSSDK !== false) {
loadResource({
type: LoadResourceUrlType.js,
path: 'https://res.wx.qq.com/open/js/jweixin-1.4.0.js',
alternatePath: 'https://res2.wx.qq.com/open/js/jweixin-1.4.0.js',
}).then(() => {
if (typeof wx === 'undefined') {
throw new Error('微信 JSSDK 加载失败')
}
config()
})
} else {
if (typeof wx === 'undefined') {
throw new Error('微信 JSSDK 加载失败')
throw new Error('请先引入微信 JSSDK')
}
config()
})
} else {
if (typeof wx === 'undefined') {
throw new Error('请先引入微信 JSSDK')
}
config()
}
}

Expand Down

0 comments on commit 4e89734

Please sign in to comment.