diff --git a/src/platforms/mp-baidu/runtime/wrapper/page-parser.js b/src/platforms/mp-baidu/runtime/wrapper/page-parser.js index aba2a228de1fa1cb1855134db88e52623b3e7cae..17bcda323e9801cf45e8c9cc44e584fd8fe506ca 100644 --- a/src/platforms/mp-baidu/runtime/wrapper/page-parser.js +++ b/src/platforms/mp-baidu/runtime/wrapper/page-parser.js @@ -1,5 +1,5 @@ import { - isPage, + isPage, initRelation } from './util' @@ -23,23 +23,23 @@ export default function parsePage (vuePageOptions) { const pageOptions = parseBasePage(vuePageOptions, { isPage, initRelation - }) - - const newLifecycle = swan.canIUse('lifecycle-2-0') - - // 纠正百度小程序新生命周期(2.0)methods:onShow在methods:onLoad之前触发的问题 - if (newLifecycle) { - delete pageOptions.methods.onShow + }) + + const newLifecycle = swan.canIUse('lifecycle-2-0') + + // 纠正百度小程序新生命周期(2.0)methods:onShow在methods:onLoad之前触发的问题 + if (newLifecycle) { + delete pageOptions.methods.onShow } pageOptions.methods.onLoad = function onLoad (args) { // 百度 onLoad 在 attached 之前触发,先存储 args, 在 attached 里边触发 onLoad - if (this.$vm) { - this.$vm.$mp.query = args - this.$vm.__call_hook('onLoad', args) - this.$vm.__call_hook('onShow') - } else { - this.pageinstance._$args = args + if (this.$vm) { + this.$vm.$mp.query = args + this.$vm.__call_hook('onLoad', args) + this.$vm.__call_hook('onShow') + } else { + this.pageinstance._$args = args } } @@ -49,4 +49,4 @@ export default function parsePage (vuePageOptions) { } return pageOptions -} +}