Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
a3067053
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看板
提交
a3067053
编写于
6月 07, 2023
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(mp): navigateTo eventChannel Disorder of sequence problem
上级
1566d886
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
63 addition
and
52 deletion
+63
-52
packages/uni-mp-alipay/src/api/protocols.ts
packages/uni-mp-alipay/src/api/protocols.ts
+5
-1
packages/uni-mp-baidu/src/api/protocols.ts
packages/uni-mp-baidu/src/api/protocols.ts
+3
-1
packages/uni-mp-core/src/api/index.ts
packages/uni-mp-core/src/api/index.ts
+3
-1
packages/uni-mp-core/src/api/protocols/index.ts
packages/uni-mp-core/src/api/protocols/index.ts
+1
-1
packages/uni-mp-core/src/api/protocols/navigateTo.ts
packages/uni-mp-core/src/api/protocols/navigateTo.ts
+23
-25
packages/uni-mp-core/src/runtime/componentInstance.ts
packages/uni-mp-core/src/runtime/componentInstance.ts
+11
-2
packages/uni-mp-jd/src/api/protocols.ts
packages/uni-mp-jd/src/api/protocols.ts
+4
-8
packages/uni-mp-kuaishou/src/api/protocols.ts
packages/uni-mp-kuaishou/src/api/protocols.ts
+3
-2
packages/uni-mp-qq/src/api/protocols.ts
packages/uni-mp-qq/src/api/protocols.ts
+2
-1
packages/uni-mp-toutiao/src/api/protocols.ts
packages/uni-mp-toutiao/src/api/protocols.ts
+2
-1
packages/uni-mp-xhs/src/api/protocols.ts
packages/uni-mp-xhs/src/api/protocols.ts
+4
-8
packages/uni-quickapp-webview/src/api/protocols.ts
packages/uni-quickapp-webview/src/api/protocols.ts
+2
-1
未找到文件。
packages/uni-mp-alipay/src/api/protocols.ts
浏览文件 @
a3067053
...
...
@@ -4,11 +4,12 @@ import {
addSafeAreaInsets
,
useDeviceId
,
populateParameters
,
navigateTo
as
_navigateTo
,
}
from
'
@dcloudio/uni-mp-core
'
import
{
getStorageSync
}
from
'
./shims
'
export
{
redirectTo
,
navigateTo
}
from
'
@dcloudio/uni-mp-core
'
export
{
redirectTo
}
from
'
@dcloudio/uni-mp-core
'
function
handleNetworkInfo
(
fromRes
:
my
.
IGetNetworkTypeSuccessResult
,
...
...
@@ -488,3 +489,6 @@ export const chooseAddress = {
toRes
.
errMsg
=
toRes
.
errMsg
+
'
'
+
fromRes
.
resultStatus
},
}
export
const
navigateTo
=
my
.
canIUse
(
'
getOpenerEventChannel
'
)
?
{}
:
_navigateTo
()
packages/uni-mp-baidu/src/api/protocols.ts
浏览文件 @
a3067053
export
{
redirectTo
,
navigateTo
,
previewImage
,
getSystemInfo
,
getSystemInfoSync
,
}
from
'
@dcloudio/uni-mp-core
'
import
{
navigateTo
as
_navigateTo
}
from
'
@dcloudio/uni-mp-core
'
function
createTodoMethod
(
contextName
:
string
,
methodName
:
string
)
{
return
function
unsupported
()
{
...
...
@@ -104,3 +104,5 @@ export const getAccountInfoSync = {
}
},
}
export
const
navigateTo
=
_navigateTo
()
packages/uni-mp-core/src/api/index.ts
浏览文件 @
a3067053
...
...
@@ -71,9 +71,11 @@ export function initUni(
// 处理 api mp 打包后为不同js,emitter 无法共享问题
if
(
__PLATFORM__
===
'
mp-alipay
'
)
{
platform
.
$emit
=
$emit
if
(
!
my
.
canIUse
(
'
getOpenerEventChannel
'
))
platform
.
getEventChannel
=
getEventChannel
}
// 处理 api mp 打包后为不同js,getEventChannel 无法共享问题
if
(
__PLATFORM__
!==
'
mp-weixin
'
)
{
if
(
__PLATFORM__
!==
'
mp-weixin
'
&&
__PLATFORM__
!==
'
mp-alipay
'
)
{
platform
.
getEventChannel
=
getEventChannel
}
...
...
packages/uni-mp-core/src/api/protocols/index.ts
浏览文件 @
a3067053
...
...
@@ -8,7 +8,7 @@ export { getSystemInfoSync } from './getSystemInfoSync'
export
{
redirectTo
}
from
'
./redirectTo
'
export
{
previewImage
}
from
'
./previewImage
'
export
{
showActionSheet
}
from
'
./showActionSheet
'
export
{
navigateTo
,
initEventChannel
,
getEventChannel
}
from
'
./navigateTo
'
export
{
navigateTo
,
getEventChannel
}
from
'
./navigateTo
'
export
{
getDeviceInfo
}
from
'
./getDeviceInfo
'
export
{
getAppBaseInfo
}
from
'
./getAppBaseInfo
'
export
{
getWindowInfo
}
from
'
./getWindowInfo
'
...
...
packages/uni-mp-core/src/api/protocols/navigateTo.ts
浏览文件 @
a3067053
...
...
@@ -3,11 +3,9 @@ import { MPProtocol } from './types'
const
eventChannels
:
Record
<
string
,
EventChannel
>
=
{}
const
eventChannelStack
:
EventChannel
[]
=
[]
let
id
=
0
export
function
initEventChannel
(
function
initEventChannel
(
events
:
Record
<
string
,
(...
args
:
any
[])
=>
void
>
,
cache
=
true
)
{
...
...
@@ -15,32 +13,32 @@ export function initEventChannel(
const
eventChannel
=
new
__GLOBAL__
.
EventChannel
(
id
,
events
)
if
(
cache
)
{
eventChannels
[
id
]
=
eventChannel
eventChannelStack
.
push
(
eventChannel
)
}
return
eventChannel
}
export
function
getEventChannel
(
id
?:
number
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
]
delete
eventChannels
[
id
]
return
eventChannel
}
return
eventChannelStack
.
shift
()
export
function
getEventChannel
(
id
:
number
)
{
const
eventChannel
=
eventChannels
[
id
]
delete
eventChannels
[
id
]
return
eventChannel
}
export
const
navigateTo
:
MPProtocol
=
{
args
(
fromArgs
)
{
const
id
=
initEventChannel
(
fromArgs
.
events
).
id
if
(
fromArgs
.
url
)
{
fromArgs
.
url
=
fromArgs
.
url
+
(
fromArgs
.
url
.
indexOf
(
'
?
'
)
===
-
1
?
'
?
'
:
'
&
'
)
+
'
__id__=
'
+
id
}
},
returnValue
(
fromRes
)
{
fromRes
.
eventChannel
=
getEventChannel
()
},
export
const
navigateTo
=
():
MPProtocol
=>
{
let
eventChannel
:
EventChannel
return
{
args
(
fromArgs
)
{
eventChannel
=
initEventChannel
(
fromArgs
.
events
)
if
(
fromArgs
.
url
)
{
fromArgs
.
url
=
fromArgs
.
url
+
(
fromArgs
.
url
.
indexOf
(
'
?
'
)
===
-
1
?
'
?
'
:
'
&
'
)
+
'
__id__=
'
+
eventChannel
.
id
}
},
returnValue
(
fromRes
)
{
fromRes
.
eventChannel
=
eventChannel
},
}
}
packages/uni-mp-core/src/runtime/componentInstance.ts
浏览文件 @
a3067053
...
...
@@ -3,7 +3,7 @@ import {
invokeArrayFns
,
SLOT_DEFAULT_NAME
,
}
from
'
@dcloudio/uni-shared
'
import
{
capitalize
,
hasOwn
,
isArray
}
from
'
@vue/shared
'
import
{
capitalize
,
hasOwn
,
isArray
,
isFunction
}
from
'
@vue/shared
'
import
{
ComponentPublicInstance
,
...
...
@@ -97,6 +97,10 @@ export function initBaseInstance(
if
(
__PLATFORM__
===
'
mp-weixin
'
)
{
return
options
.
mpInstance
.
getOpenerEventChannel
()
}
if
(
__PLATFORM__
===
'
mp-alipay
'
)
{
if
(
my
.
canIUse
(
'
getOpenerEventChannel
'
))
return
options
.
mpInstance
.
getOpenerEventChannel
()
}
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
()
}
...
...
@@ -158,7 +162,12 @@ function callHook(this: ComponentPublicInstance, name: string, args?: unknown) {
name
=
'
m
'
}
if
(
__PLATFORM__
!==
'
mp-weixin
'
)
{
if
(
name
===
'
onLoad
'
&&
args
&&
(
args
as
any
).
__id__
)
{
if
(
name
===
'
onLoad
'
&&
args
&&
(
args
as
any
).
__id__
&&
isFunction
(
__GLOBAL__
.
getEventChannel
)
)
{
;(
this
as
any
).
__eventChannel__
=
__GLOBAL__
.
getEventChannel
(
(
args
as
any
).
__id__
)
...
...
packages/uni-mp-jd/src/api/protocols.ts
浏览文件 @
a3067053
import
{
redirectTo
,
navigateTo
,
navigateTo
as
_navigateTo
,
previewImage
,
getSystemInfo
,
getSystemInfoSync
,
}
from
'
@dcloudio/uni-mp-core
'
export
{
redirectTo
,
navigateTo
,
previewImage
,
getSystemInfo
,
getSystemInfoSync
,
}
export
{
redirectTo
,
previewImage
,
getSystemInfo
,
getSystemInfoSync
}
export
const
navigateTo
=
_navigateTo
()
packages/uni-mp-kuaishou/src/api/protocols.ts
浏览文件 @
a3067053
import
{
redirectTo
,
navigateTo
,
navigateTo
as
_navigateTo
,
previewImage
,
getSystemInfo
,
getSystemInfoSync
,
...
...
@@ -19,9 +19,10 @@ const requestPayment: MPProtocol = {
export
{
redirectTo
,
navigateTo
,
previewImage
,
getSystemInfo
,
getSystemInfoSync
,
requestPayment
,
}
export
const
navigateTo
=
_navigateTo
()
packages/uni-mp-qq/src/api/protocols.ts
浏览文件 @
a3067053
export
{
redirectTo
,
navigateTo
,
previewImage
,
getSystemInfo
,
getSystemInfoSync
,
}
from
'
@dcloudio/uni-mp-core
'
import
{
navigateTo
as
_navigateTo
}
from
'
@dcloudio/uni-mp-core
'
export
const
navigateTo
=
_navigateTo
()
packages/uni-mp-toutiao/src/api/protocols.ts
浏览文件 @
a3067053
export
{
redirectTo
,
navigateTo
,
previewImage
,
getSystemInfo
,
getSystemInfoSync
,
}
from
'
@dcloudio/uni-mp-core
'
import
{
navigateTo
as
_navigateTo
}
from
'
@dcloudio/uni-mp-core
'
export
const
navigateTo
=
_navigateTo
()
export
const
connectSocket
=
{
args
:
{
method
:
false
,
...
...
packages/uni-mp-xhs/src/api/protocols.ts
浏览文件 @
a3067053
import
{
redirectTo
,
navigateTo
,
navigateTo
as
_navigateTo
,
previewImage
,
getSystemInfo
,
getSystemInfoSync
,
}
from
'
@dcloudio/uni-mp-core
'
export
{
redirectTo
,
navigateTo
,
previewImage
,
getSystemInfo
,
getSystemInfoSync
,
}
export
{
redirectTo
,
previewImage
,
getSystemInfo
,
getSystemInfoSync
}
export
const
navigateTo
=
_navigateTo
()
packages/uni-quickapp-webview/src/api/protocols.ts
浏览文件 @
a3067053
export
{
redirectTo
,
navigateTo
,
previewImage
,
getSystemInfo
,
getSystemInfoSync
,
}
from
'
@dcloudio/uni-mp-core
'
import
{
navigateTo
as
_navigateTo
}
from
'
@dcloudio/uni-mp-core
'
export
const
navigateTo
=
_navigateTo
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录