提交 79a5527f 编写于 作者: H hadi

fix(uni-mp-xhs): fix the issue of useRef component being undefined

上级 dfaa58db
......@@ -1938,15 +1938,10 @@ class EventChannel {
const eventChannels = {};
const eventChannelStack = [];
function getEventChannel (id) {
if (id) {
const eventChannel = eventChannels[id];
delete eventChannels[id];
return eventChannel
}
return eventChannelStack.shift()
const eventChannel = eventChannels[id];
delete eventChannels[id];
return eventChannel
}
const hooks = [
......@@ -2254,36 +2249,38 @@ function parsePage (vuePageOptions) {
onLoad (query) {
const properties = this.props;
const options = {
this.__query = query;
this.__options = {
mpType: 'page',
mpInstance: this,
propsData: properties
};
},
onReady () {
// initChildVues(this)
// 初始化 vue 实例
this.$vm = new VueComponent(options);
initSpecialMethods(this);
this.$vm = new VueComponent(this.__options);
// 触发首次 setData
this.$vm.$mount();
const copyQuery = Object.assign({}, query);
delete copyQuery.__id__;
initSpecialMethods(this);
this.$vm._isMounted = true;
this.$vm.__call_hook('mounted');
// mounted => onLoad
this.options = this.__query;
this.$vm.$mp.query = this.__query; // 兼容 mpvue
const copyQuery = Object.assign({}, this.__query);
delete copyQuery.__id__;
this.$page = {
fullPath: '/' + this.route + stringifyQuery(copyQuery)
};
this.options = query;
this.$vm.$mp.query = query; // 兼容 mpvue
this.$vm.__call_hook('onLoad', query);
},
onReady () {
// initChildVues(this)
this.$vm._isMounted = true;
this.$vm.__call_hook('mounted');
this.$vm.__call_hook('onReady');
this.$vm.__call_hook('onLoad', this.__query);
setTimeout(() => {
this.$vm.__call_hook('onReady');
});
},
onUnload () {
this.$vm.__call_hook('onUnload');
......@@ -2590,7 +2587,7 @@ if (typeof Proxy !== 'undefined' && "mp-xhs" !== 'app-plus') {
uni[name] = promisify(name, todoApis[name]);
});
Object.keys(extraApi).forEach(name => {
uni[name] = promisify(name, todoApis[name]);
uni[name] = promisify(name, extraApi[name]);
});
}
......
......@@ -38,36 +38,38 @@ export default function parsePage (vuePageOptions) {
onLoad (query) {
const properties = this.props
const options = {
this.__query = query
this.__options = {
mpType: 'page',
mpInstance: this,
propsData: properties
}
},
onReady () {
// initChildVues(this)
// 初始化 vue 实例
this.$vm = new VueComponent(options)
initSpecialMethods(this)
this.$vm = new VueComponent(this.__options)
// 触发首次 setData
this.$vm.$mount()
const copyQuery = Object.assign({}, query)
delete copyQuery.__id__
initSpecialMethods(this)
this.$vm._isMounted = true
this.$vm.__call_hook('mounted')
// mounted => onLoad
this.options = this.__query
this.$vm.$mp.query = this.__query // 兼容 mpvue
const copyQuery = Object.assign({}, this.__query)
delete copyQuery.__id__
this.$page = {
fullPath: '/' + this.route + stringifyQuery(copyQuery)
}
this.options = query
this.$vm.$mp.query = query // 兼容 mpvue
this.$vm.__call_hook('onLoad', query)
},
onReady () {
// initChildVues(this)
this.$vm._isMounted = true
this.$vm.__call_hook('mounted')
this.$vm.__call_hook('onReady')
this.$vm.__call_hook('onLoad', this.__query)
setTimeout(() => {
this.$vm.__call_hook('onReady')
});
},
onUnload () {
this.$vm.__call_hook('onUnload')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册