提交 114d06de 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

fix(mp-weixin): 单页模式访问wx部分属性报错

上级 70041fbc
......@@ -9,15 +9,23 @@ const objectKeys = [
'router',
'worklet',
]
const singlePageDisableKey = [
'lanDebug',
'router',
'worklet',
]
const target = typeof globalThis !== 'undefined' ? globalThis : (function() {
return this
})()
const key = ['w', 'x'].join('')
const oldWx = target[key]
const launchOption = oldWx.getLaunchOptionsSync()
function isWxKey(key) {
if (launchOption.scene === 1154 && singlePageDisableKey.includes(key)) {
return false
}
return objectKeys.indexOf(key) > -1 || typeof oldWx[key] === 'function'
}
......@@ -32,4 +40,4 @@ function initWx() {
return newWx
}
target[key] = initWx()
export default target[key]
export default target[key]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册