提交 89b83259 编写于 作者: fxy060608's avatar fxy060608

fix(mp): mp-baidu ios onLoad args

上级 5e0d15df
...@@ -1107,6 +1107,8 @@ function initRelation$1 (detail) { ...@@ -1107,6 +1107,8 @@ function initRelation$1 (detail) {
this.dispatch('__l', detail); this.dispatch('__l', detail);
} }
const isIOS$1 = swan.getSystemInfoSync().platform === 'ios';
function parseApp (vm) { function parseApp (vm) {
return parseBaseApp(vm, { return parseBaseApp(vm, {
mocks: mocks$1, mocks: mocks$1,
...@@ -1210,8 +1212,10 @@ function parseComponent (vueOptions) { ...@@ -1210,8 +1212,10 @@ function parseComponent (vueOptions) {
// 百度 当组件作为页面时 pageinstancce 不是原来组件的 instance // 百度 当组件作为页面时 pageinstancce 不是原来组件的 instance
this.pageinstance.$vm = this.$vm; this.pageinstance.$vm = this.$vm;
if (!isIOS$1) {
this.$vm.$mp.query = this.pageinstance._$args; // 兼容 mpvue this.$vm.$mp.query = this.pageinstance._$args; // 兼容 mpvue
this.$vm.__call_hook('onLoad', this.pageinstance._$args); this.$vm.__call_hook('onLoad', this.pageinstance._$args);
}
// TODO 目前版本 百度 Component 作为页面时,methods 中的 onShow 不触发 // TODO 目前版本 百度 Component 作为页面时,methods 中的 onShow 不触发
this.$vm.__call_hook('onShow'); this.$vm.__call_hook('onShow');
} }
...@@ -1275,6 +1279,11 @@ function parsePage (vuePageOptions) { ...@@ -1275,6 +1279,11 @@ function parsePage (vuePageOptions) {
pageOptions.methods.onLoad = function onLoad (args) { pageOptions.methods.onLoad = function onLoad (args) {
// 百度 onLoad 在 attached 之前触发,先存储 args, 在 attached 里边触发 onLoad // 百度 onLoad 在 attached 之前触发,先存储 args, 在 attached 里边触发 onLoad
this.pageinstance._$args = args; this.pageinstance._$args = args;
if (isIOS$1) {
this.$vm.$mp.query = this.pageinstance._$args; // 兼容 mpvue
this.$vm.__call_hook('onLoad', this.pageinstance._$args);
}
}; };
// TODO 目前版本 百度 Component 作为页面时,methods 中的 onShow 不触发 // TODO 目前版本 百度 Component 作为页面时,methods 中的 onShow 不触发
delete pageOptions.methods.onShow; delete pageOptions.methods.onShow;
......
{ {
"name": "@dcloudio/uni-mp-baidu", "name": "@dcloudio/uni-mp-baidu",
"version": "0.0.839", "version": "0.0.840",
"description": "uni-app mp-baidu", "description": "uni-app mp-baidu",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
import { import {
isPage, isPage,
isIOS,
initRelation initRelation
} from './util' } from './util'
...@@ -19,8 +20,10 @@ export default function parseComponent (vueOptions) { ...@@ -19,8 +20,10 @@ export default function parseComponent (vueOptions) {
// 百度 当组件作为页面时 pageinstancce 不是原来组件的 instance // 百度 当组件作为页面时 pageinstancce 不是原来组件的 instance
this.pageinstance.$vm = this.$vm this.pageinstance.$vm = this.$vm
if (!isIOS) {
this.$vm.$mp.query = this.pageinstance._$args // 兼容 mpvue this.$vm.$mp.query = this.pageinstance._$args // 兼容 mpvue
this.$vm.__call_hook('onLoad', this.pageinstance._$args) this.$vm.__call_hook('onLoad', this.pageinstance._$args)
}
// TODO 目前版本 百度 Component 作为页面时,methods 中的 onShow 不触发 // TODO 目前版本 百度 Component 作为页面时,methods 中的 onShow 不触发
this.$vm.__call_hook('onShow') this.$vm.__call_hook('onShow')
} }
......
import { import {
isPage, isPage,
isIOS,
initRelation initRelation
} from './util' } from './util'
...@@ -28,6 +29,11 @@ export default function parsePage (vuePageOptions) { ...@@ -28,6 +29,11 @@ export default function parsePage (vuePageOptions) {
pageOptions.methods.onLoad = function onLoad (args) { pageOptions.methods.onLoad = function onLoad (args) {
// 百度 onLoad 在 attached 之前触发,先存储 args, 在 attached 里边触发 onLoad // 百度 onLoad 在 attached 之前触发,先存储 args, 在 attached 里边触发 onLoad
this.pageinstance._$args = args this.pageinstance._$args = args
if (isIOS) {
this.$vm.$mp.query = this.pageinstance._$args // 兼容 mpvue
this.$vm.__call_hook('onLoad', this.pageinstance._$args)
}
} }
// TODO 目前版本 百度 Component 作为页面时,methods 中的 onShow 不触发 // TODO 目前版本 百度 Component 作为页面时,methods 中的 onShow 不触发
delete pageOptions.methods.onShow delete pageOptions.methods.onShow
......
...@@ -7,3 +7,5 @@ export function isPage () { ...@@ -7,3 +7,5 @@ export function isPage () {
export function initRelation (detail) { export function initRelation (detail) {
this.dispatch('__l', 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.
先完成此消息的编辑!
想要评论请 注册