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

fix(runtime): mp生命周期

上级 a928539a
......@@ -562,7 +562,7 @@ const hooks$1 = [
'onNavigationBarSearchInputClicked'
];
function attached (VueComponent, args) {
function attached (VueComponent) {
this.$vm = new VueComponent({
mpType: 'page',
......@@ -570,10 +570,6 @@ function attached (VueComponent, args) {
});
this.$vm.__call_hook('created');
if (args) {
this.$vm.$mp.query = args; // 又要兼容 mpvue
this.$vm.__call_hook('onLoad', args); // 开发者可能会在 onLoad 时赋值,提前到 mount 之前
}
this.$vm.$mount();
}
......@@ -618,7 +614,8 @@ function createPage (vueOptions) {
},
methods: { // 作为页面时
onLoad (args) {
attached.call(this, VueComponent, args);
this.$vm.$mp.query = args; // 又要兼容 mpvue
this.$vm.__call_hook('onLoad', args); // 开发者可能会在 onLoad 时赋值,提前到 mount 之前
},
__e: handleEvent,
__l: handleLink
......
{
"name": "@dcloudio/uni-mp-weixin",
"version": "0.0.920",
"version": "0.0.921",
"description": "uni-app mp-weixin",
"main": "dist/index.js",
"scripts": {
......
......@@ -31,7 +31,7 @@ const hooks = [
'onNavigationBarSearchInputClicked'
]
function attached (VueComponent, args) {
function attached (VueComponent) {
if (__PLATFORM__ === 'mp-baidu') {
this.$baiduComponentInstances = Object.create(null)
}
......@@ -42,10 +42,6 @@ function attached (VueComponent, args) {
})
this.$vm.__call_hook('created')
if (args) {
this.$vm.$mp.query = args // 又要兼容 mpvue
this.$vm.__call_hook('onLoad', args) // 开发者可能会在 onLoad 时赋值,提前到 mount 之前
}
this.$vm.$mount()
}
......@@ -92,7 +88,8 @@ export function createPage (vueOptions) {
},
methods: { // 作为页面时
onLoad (args) {
attached.call(this, VueComponent, args)
this.$vm.$mp.query = args // 又要兼容 mpvue
this.$vm.__call_hook('onLoad', args) // 开发者可能会在 onLoad 时赋值,提前到 mount 之前
},
__e: handleEvent,
__l: handleLink
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册