Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
ad1b719f
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
717
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ad1b719f
编写于
2月 22, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(mp-baidu): add $page
上级
65e0f243
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
8 deletion
+45
-8
packages/uni-mp-baidu/dist/uni.mp.esm.js
packages/uni-mp-baidu/dist/uni.mp.esm.js
+30
-4
packages/uni-mp-baidu/src/runtime/parsePageOptions.ts
packages/uni-mp-baidu/src/runtime/parsePageOptions.ts
+15
-4
未找到文件。
packages/uni-mp-baidu/dist/uni.mp.esm.js
浏览文件 @
ad1b719f
import
{
camelize
,
isPlainObject
,
isArray
,
hasOwn
,
isFunction
,
extend
}
from
'
@vue/shared
'
;
import
{
isPlainObject
,
camelize
,
isArray
,
hasOwn
,
isFunction
,
extend
}
from
'
@vue/shared
'
;
import
{
injectHook
,
ref
,
nextTick
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
getExposeProxy
,
pruneComponentPropsCache
}
from
'
vue
'
;
// lifecycle
...
...
@@ -8,6 +8,26 @@ const ON_SHOW$1 = 'onShow';
const
ON_LOAD$1
=
'
onLoad
'
;
const
ON_READY$1
=
'
onReady
'
;
const
encode$1
=
encodeURIComponent
;
function
stringifyQuery$1
(
obj
,
encodeStr
=
encode$1
)
{
const
res
=
obj
?
Object
.
keys
(
obj
)
.
map
((
key
)
=>
{
let
val
=
obj
[
key
];
if
(
typeof
val
===
undefined
||
val
===
null
)
{
val
=
''
;
}
else
if
(
isPlainObject
(
val
))
{
val
=
JSON
.
stringify
(
val
);
}
return
encodeStr
(
key
)
+
'
=
'
+
encodeStr
(
val
);
})
.
filter
((
x
)
=>
x
.
length
>
0
)
.
join
(
'
&
'
)
:
null
;
return
res
?
`?
${
res
}
`
:
''
;
}
class
EventChannel$1
{
constructor
(
id
,
events
)
{
this
.
id
=
id
;
...
...
@@ -1152,15 +1172,21 @@ function parse(pageOptions) {
this
.
$vm
.
$callHook
(
ON_SHOW$1
);
}
};
methods
.
onLoad
=
function
onLoad
(
args
)
{
methods
.
onLoad
=
function
onLoad
(
query
)
{
// 百度 onLoad 在 attached 之前触发,先存储 args, 在 attached 里边触发 onLoad
if
(
this
.
$vm
)
{
this
.
_$loaded
=
true
;
this
.
$vm
.
$callHook
(
ON_LOAD$1
,
args
);
const
copyQuery
=
extend
({},
query
);
delete
copyQuery
.
__id__
;
this
.
options
=
copyQuery
;
this
.
pageinstance
.
$page
=
this
.
$page
=
{
fullPath
:
'
/
'
+
this
.
pageinstance
.
route
+
stringifyQuery$1
(
copyQuery
),
};
this
.
$vm
.
$callHook
(
ON_LOAD$1
,
query
);
this
.
$vm
.
$callHook
(
ON_SHOW$1
);
}
else
{
this
.
pageinstance
.
_$args
=
args
;
this
.
pageinstance
.
_$args
=
query
;
}
};
}
...
...
packages/uni-mp-baidu/src/runtime/parsePageOptions.ts
浏览文件 @
ad1b719f
import
{
extend
}
from
'
@vue/shared
'
import
{
MPComponentOptions
,
MPComponentInstance
}
from
'
@dcloudio/uni-mp-core
'
import
{
ON_LOAD
,
ON_SHOW
}
from
'
@dcloudio/uni-shared
'
import
{
ON_LOAD
,
ON_SHOW
,
stringifyQuery
}
from
'
@dcloudio/uni-shared
'
import
{
parse
as
parseComponentOptions
}
from
'
./parseComponentOptions
'
...
...
@@ -18,14 +19,24 @@ export function parse(pageOptions: MPComponentOptions) {
}
}
methods
.
onLoad
=
function
onLoad
(
this
:
MPComponentInstance
,
args
)
{
methods
.
onLoad
=
function
onLoad
(
this
:
MPComponentInstance
,
query
:
Record
<
string
,
any
>
)
{
// 百度 onLoad 在 attached 之前触发,先存储 args, 在 attached 里边触发 onLoad
if
(
this
.
$vm
)
{
;(
this
as
any
).
_$loaded
=
true
this
.
$vm
.
$callHook
(
ON_LOAD
,
args
)
const
copyQuery
=
extend
({},
query
)
delete
copyQuery
.
__id__
;(
this
as
any
).
options
=
copyQuery
;(
this
as
any
).
pageinstance
.
$page
=
(
this
as
any
).
$page
=
{
fullPath
:
'
/
'
+
(
this
as
any
).
pageinstance
.
route
+
stringifyQuery
(
copyQuery
),
}
this
.
$vm
.
$callHook
(
ON_LOAD
,
query
)
this
.
$vm
.
$callHook
(
ON_SHOW
)
}
else
{
;(
this
as
any
).
pageinstance
.
_$args
=
args
;(
this
as
any
).
pageinstance
.
_$args
=
query
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录