提交 4702bf0d 编写于 作者: Q qiang

fix: 部分报错调整为仅在开发环境打印

上级 90c202f8
...@@ -9,13 +9,13 @@ export default function initSubscribe (subscribe, { ...@@ -9,13 +9,13 @@ export default function initSubscribe (subscribe, {
getCurrentPages getCurrentPages
}) { }) {
function createPageEvent (eventType) { function createPageEvent (eventType) {
return function (args, pageId) { return function (args, pageId) {
pageId = parseInt(pageId) pageId = parseInt(pageId)
const pages = getCurrentPages() const pages = getCurrentPages()
const page = pages.find(page => page.$page.id === pageId) const page = pages.find(page => page.$page.id === pageId)
if (page) { if (page) {
callPageHook(page, eventType, args) callPageHook(page, eventType, args)
} else { } else if (process.env.NODE_ENV !== 'production') {
console.error(`Not Found:Page[${pageId}]`) console.error(`Not Found:Page[${pageId}]`)
} }
} }
...@@ -48,7 +48,7 @@ export default function initSubscribe (subscribe, { ...@@ -48,7 +48,7 @@ export default function initSubscribe (subscribe, {
} }
callback(res) callback(res)
} }
} }
if (__PLATFORM__ === 'h5') { if (__PLATFORM__ === 'h5') {
subscribe('onPageReady', createPageEvent('onReady')) subscribe('onPageReady', createPageEvent('onReady'))
...@@ -59,4 +59,4 @@ export default function initSubscribe (subscribe, { ...@@ -59,4 +59,4 @@ export default function initSubscribe (subscribe, {
subscribe('onRequestComponentInfo', onRequestComponentInfo) subscribe('onRequestComponentInfo', onRequestComponentInfo)
subscribe('onRequestComponentObserver', onRequestComponentObserver) subscribe('onRequestComponentObserver', onRequestComponentObserver)
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册