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

fix(mp-baidu): App.vue onShow

上级 032f8902
......@@ -993,18 +993,18 @@ function handleEvent (event) {
});
}
const hooks = [
const hooks = [
'onShow',
'onHide',
'onError',
'onPageNotFound'
];
function parseBaseApp (vm, {
function parseBaseApp (vm, {
mocks,
initRefs
}) {
Vue.prototype.mpHost = "mp-baidu";
}) {
Vue.prototype.mpHost = "mp-baidu";
Vue.mixin({
beforeCreate () {
......@@ -1033,6 +1033,9 @@ function parseBaseApp (vm, {
const appOptions = {
onLaunch (args) {
if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
return
}
this.$vm = vm;
......@@ -1130,10 +1133,18 @@ function initRelation$1 (detail) {
}
function parseApp (vm) {
return parseBaseApp(vm, {
// 百度 onShow 竟然会在 onLaunch 之前
const appOptions = parseBaseApp(vm, {
mocks: mocks$1,
initRefs
})
});
appOptions.onShow = function onShow (args) {
if (!this.$vm) {
this.onLaunch(args);
}
this.$vm.__call_hook('onShow', args);
};
return appOptions
}
function createApp (vm) {
......
......@@ -9,8 +9,16 @@ import {
} from './util'
export default function parseApp (vm) {
return parseBaseApp(vm, {
// 百度 onShow 竟然会在 onLaunch 之前
const appOptions = parseBaseApp(vm, {
mocks,
initRefs
})
appOptions.onShow = function onShow (args) {
if (!this.$vm) {
this.onLaunch(args)
}
this.$vm.__call_hook('onShow', args)
}
return appOptions
}
......@@ -5,18 +5,18 @@ import {
initMocks
} from 'uni-wrapper/util'
const hooks = [
const hooks = [
'onShow',
'onHide',
'onError',
'onPageNotFound'
]
export default function parseBaseApp (vm, {
export default function parseBaseApp (vm, {
mocks,
initRefs
}) {
Vue.prototype.mpHost = __PLATFORM__
}) {
Vue.prototype.mpHost = __PLATFORM__
Vue.mixin({
beforeCreate () {
......@@ -45,6 +45,9 @@ export default function parseBaseApp (vm, {
const appOptions = {
onLaunch (args) {
if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
return
}
if (__PLATFORM__ === 'mp-weixin') {
if (!wx.canIUse('nextTick')) { // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册