提交 69116b84 编写于 作者: fxy060608's avatar fxy060608

fix(uni-mp-baidu): 修复百度小程序直达时的生命周期触发 bug

上级 6fa0a893
......@@ -1105,9 +1105,7 @@ function isPage$1 () {
function initRelation$1 (detail) {
this.dispatch('__l', detail);
}
const isIOS$1 = swan.getSystemInfoSync().platform === 'ios';
}
function parseApp (vm) {
return parseBaseApp(vm, {
......@@ -1212,9 +1210,10 @@ function parseComponent (vueOptions) {
// 百度 当组件作为页面时 pageinstancce 不是原来组件的 instance
this.pageinstance.$vm = this.$vm;
if (!isIOS$1) {
this.$vm.$mp.query = this.pageinstance._$args; // 兼容 mpvue
this.$vm.__call_hook('onLoad', this.pageinstance._$args);
if (hasOwn(this.pageinstance, '_$args')) {
this.$vm.$mp.query = this.pageinstance._$args;
this.$vm.__call_hook('onLoad', this.pageinstance._$args);
delete this.pageinstance._$args;
}
// TODO 目前版本 百度 Component 作为页面时,methods 中的 onShow 不触发
this.$vm.__call_hook('onShow');
......@@ -1278,11 +1277,11 @@ function parsePage (vuePageOptions) {
pageOptions.methods.onLoad = function onLoad (args) {
// 百度 onLoad 在 attached 之前触发,先存储 args, 在 attached 里边触发 onLoad
this.pageinstance._$args = args;
if (isIOS$1) {
this.$vm.$mp.query = this.pageinstance._$args; // 兼容 mpvue
this.$vm.__call_hook('onLoad', this.pageinstance._$args);
if (this.$vm) {
this.$vm.$mp.query = args;
this.$vm.__call_hook('onLoad', args);
} else {
this.pageinstance._$args = args;
}
};
// TODO 目前版本 百度 Component 作为页面时,methods 中的 onShow 不触发
......
{
"name": "@dcloudio/uni-mp-baidu",
"version": "0.0.840",
"version": "0.0.841",
"description": "uni-app mp-baidu",
"main": "dist/index.js",
"scripts": {
......
import {
hasOwn
} from 'uni-shared'
import {
isPage,
isIOS,
initRelation
} from './util'
......@@ -20,9 +23,10 @@ export default function parseComponent (vueOptions) {
// 百度 当组件作为页面时 pageinstancce 不是原来组件的 instance
this.pageinstance.$vm = this.$vm
if (!isIOS) {
this.$vm.$mp.query = this.pageinstance._$args // 兼容 mpvue
this.$vm.__call_hook('onLoad', this.pageinstance._$args)
if (hasOwn(this.pageinstance, '_$args')) {
this.$vm.$mp.query = this.pageinstance._$args
this.$vm.__call_hook('onLoad', this.pageinstance._$args)
delete this.pageinstance._$args
}
// TODO 目前版本 百度 Component 作为页面时,methods 中的 onShow 不触发
this.$vm.__call_hook('onShow')
......
import {
isPage,
isIOS,
initRelation
} from './util'
......@@ -28,11 +27,11 @@ export default function parsePage (vuePageOptions) {
pageOptions.methods.onLoad = function onLoad (args) {
// 百度 onLoad 在 attached 之前触发,先存储 args, 在 attached 里边触发 onLoad
this.pageinstance._$args = args
if (isIOS) {
this.$vm.$mp.query = this.pageinstance._$args // 兼容 mpvue
this.$vm.__call_hook('onLoad', this.pageinstance._$args)
if (this.$vm) {
this.$vm.$mp.query = args
this.$vm.__call_hook('onLoad', args)
} else {
this.pageinstance._$args = args
}
}
// TODO 目前版本 百度 Component 作为页面时,methods 中的 onShow 不触发
......
......@@ -7,5 +7,3 @@ export function isPage () {
export function initRelation (detail) {
this.dispatch('__l', detail)
}
export const isIOS = swan.getSystemInfoSync().platform === 'ios'
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册