Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
79a5527f
U
uni-app
项目概览
DCloud
/
uni-app
14 天 前同步成功
通知
751
Star
38709
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
8
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
8
Issue
8
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
79a5527f
编写于
8月 02, 2023
作者:
H
hadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(uni-mp-xhs): fix the issue of useRef component being undefined
上级
dfaa58db
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
40 addition
and
41 deletion
+40
-41
packages/uni-mp-xhs/dist/index.js
packages/uni-mp-xhs/dist/index.js
+22
-25
src/platforms/mp-xhs/runtime/wrapper/page-parser.js
src/platforms/mp-xhs/runtime/wrapper/page-parser.js
+18
-16
未找到文件。
packages/uni-mp-xhs/dist/index.js
浏览文件 @
79a5527f
...
...
@@ -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
]);
});
}
...
...
src/platforms/mp-xhs/runtime/wrapper/page-parser.js
浏览文件 @
79a5527f
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录