Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
5d683283
U
uni-app
项目概览
DCloud
/
uni-app
5 天 前同步成功
通知
815
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看板
提交
5d683283
编写于
10月 31, 2022
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(mp): 部分小程序平台 eventChannel 通信失败问题 #3945
上级
d080007a
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
800 addition
and
855 deletion
+800
-855
packages/uni-mp-alipay/dist/uni.api.esm.js
packages/uni-mp-alipay/dist/uni.api.esm.js
+103
-101
packages/uni-mp-alipay/dist/uni.mp.esm.js
packages/uni-mp-alipay/dist/uni.mp.esm.js
+4
-13
packages/uni-mp-baidu/dist/uni.api.esm.js
packages/uni-mp-baidu/dist/uni.api.esm.js
+99
-97
packages/uni-mp-baidu/dist/uni.mp.esm.js
packages/uni-mp-baidu/dist/uni.mp.esm.js
+4
-13
packages/uni-mp-core/src/api/index.ts
packages/uni-mp-core/src/api/index.ts
+5
-1
packages/uni-mp-core/src/runtime/componentInstance.ts
packages/uni-mp-core/src/runtime/componentInstance.ts
+8
-3
packages/uni-mp-kuaishou/dist/uni.api.esm.js
packages/uni-mp-kuaishou/dist/uni.api.esm.js
+99
-97
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
+4
-13
packages/uni-mp-lark/dist/uni.api.esm.js
packages/uni-mp-lark/dist/uni.api.esm.js
+99
-97
packages/uni-mp-lark/dist/uni.mp.esm.js
packages/uni-mp-lark/dist/uni.mp.esm.js
+4
-13
packages/uni-mp-qq/dist/uni.api.esm.js
packages/uni-mp-qq/dist/uni.api.esm.js
+99
-97
packages/uni-mp-qq/dist/uni.mp.esm.js
packages/uni-mp-qq/dist/uni.mp.esm.js
+4
-13
packages/uni-mp-toutiao/dist/uni.api.esm.js
packages/uni-mp-toutiao/dist/uni.api.esm.js
+99
-97
packages/uni-mp-toutiao/dist/uni.mp.esm.js
packages/uni-mp-toutiao/dist/uni.mp.esm.js
+4
-13
packages/uni-mp-weixin/dist/uni.api.esm.js
packages/uni-mp-weixin/dist/uni.api.esm.js
+62
-62
packages/uni-mp-weixin/dist/uni.mp.esm.js
packages/uni-mp-weixin/dist/uni.mp.esm.js
+0
-15
packages/uni-quickapp-webview/dist/uni.api.esm.js
packages/uni-quickapp-webview/dist/uni.api.esm.js
+99
-97
packages/uni-quickapp-webview/dist/uni.mp.esm.js
packages/uni-quickapp-webview/dist/uni.mp.esm.js
+4
-13
未找到文件。
packages/uni-mp-alipay/dist/uni.api.esm.js
浏览文件 @
5d683283
...
...
@@ -2,42 +2,6 @@ import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawTy
import
{
LINEFEED
,
Emitter
,
onCreateVueApp
,
invokeCreateVueAppHook
}
from
'
@dcloudio/uni-shared
'
;
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
const
eventChannels
=
{};
const
eventChannelStack
=
[];
let
id
=
0
;
function
initEventChannel
(
events
,
cache
=
true
)
{
id
++
;
const
eventChannel
=
new
my
.
EventChannel
(
id
,
events
);
if
(
cache
)
{
eventChannels
[
id
]
=
eventChannel
;
eventChannelStack
.
push
(
eventChannel
);
}
return
eventChannel
;
}
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
navigateTo
=
{
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
();
},
};
function
getBaseSystemInfo
()
{
return
my
.
getSystemInfoSync
()
}
...
...
@@ -915,71 +879,6 @@ if (typeof global !== 'undefined') {
global
.
getLocale
=
getLocale
;
}
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
my
[
key
]));
},
};
// 处理 api mp 打包后为不同js,emitter 无法共享问题
{
my
.
$emit
=
$emit
;
}
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
useDeviceId
(
global
=
my
)
{
...
...
@@ -1110,6 +1009,109 @@ function getHostName(fromRes) {
const
redirectTo
=
{};
const
eventChannels
=
{};
const
eventChannelStack
=
[];
let
id
=
0
;
function
initEventChannel
(
events
,
cache
=
true
)
{
id
++
;
const
eventChannel
=
new
my
.
EventChannel
(
id
,
events
);
if
(
cache
)
{
eventChannels
[
id
]
=
eventChannel
;
eventChannelStack
.
push
(
eventChannel
);
}
return
eventChannel
;
}
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
navigateTo
=
{
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
();
},
};
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
my
[
key
]));
},
};
// 处理 api mp 打包后为不同js,emitter 无法共享问题
{
my
.
$emit
=
$emit
;
}
// 处理 api mp 打包后为不同js,getEventChannel 无法共享问题
my
.
getEventChannel
=
getEventChannel
;
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
let
onKeyboardHeightChangeCallback
;
const
getProvider
=
initGetProvider
({
oauth
:
[
'
alipay
'
],
...
...
packages/uni-mp-alipay/dist/uni.mp.esm.js
浏览文件 @
5d683283
...
...
@@ -3,17 +3,6 @@ import { isArray, hasOwn, capitalize, isFunction, extend, isPlainObject, isStrin
import
{
ref
,
findComponentPropsData
,
toRaw
,
updateProps
,
hasQueueJob
,
invalidateJob
,
getExposeProxy
,
EMPTY_OBJ
,
isRef
,
setTemplateRef
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
const
eventChannels
=
{};
const
eventChannelStack
=
[];
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
MP_METHODS
=
[
'
createSelectorQuery
'
,
'
createIntersectionObserver
'
,
...
...
@@ -108,8 +97,10 @@ function callHook(name, args) {
name
=
'
m
'
;
}
else
if
(
name
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
{
this
.
__eventChannel__
=
my
.
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
}
const
hooks
=
this
.
$
[
name
];
return
hooks
&&
invokeArrayFns
(
hooks
,
args
);
...
...
packages/uni-mp-baidu/dist/uni.api.esm.js
浏览文件 @
5d683283
...
...
@@ -2,42 +2,6 @@ import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawTy
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
import
{
LINEFEED
,
Emitter
,
onCreateVueApp
,
invokeCreateVueAppHook
}
from
'
@dcloudio/uni-shared
'
;
const
eventChannels
=
{};
const
eventChannelStack
=
[];
let
id
=
0
;
function
initEventChannel
(
events
,
cache
=
true
)
{
id
++
;
const
eventChannel
=
new
swan
.
EventChannel
(
id
,
events
);
if
(
cache
)
{
eventChannels
[
id
]
=
eventChannel
;
eventChannelStack
.
push
(
eventChannel
);
}
return
eventChannel
;
}
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
navigateTo
=
{
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
();
},
};
function
getBaseSystemInfo
()
{
return
swan
.
getSystemInfoSync
()
}
...
...
@@ -915,67 +879,6 @@ if (typeof global !== 'undefined') {
global
.
getLocale
=
getLocale
;
}
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
swan
[
key
]));
},
};
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
useDeviceId
(
global
=
swan
)
{
...
...
@@ -1143,6 +1046,105 @@ const previewImage = {
},
};
const
eventChannels
=
{};
const
eventChannelStack
=
[];
let
id
=
0
;
function
initEventChannel
(
events
,
cache
=
true
)
{
id
++
;
const
eventChannel
=
new
swan
.
EventChannel
(
id
,
events
);
if
(
cache
)
{
eventChannels
[
id
]
=
eventChannel
;
eventChannelStack
.
push
(
eventChannel
);
}
return
eventChannel
;
}
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
navigateTo
=
{
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
();
},
};
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
swan
[
key
]));
},
};
// 处理 api mp 打包后为不同js,getEventChannel 无法共享问题
swan
.
getEventChannel
=
getEventChannel
;
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
const
getProvider
=
initGetProvider
({
oauth
:
[
'
baidu
'
],
share
:
[
'
baidu
'
],
...
...
packages/uni-mp-baidu/dist/uni.mp.esm.js
浏览文件 @
5d683283
...
...
@@ -3,17 +3,6 @@ import { isArray, hasOwn, isFunction, extend, hyphenate, isPlainObject } from '@
import
{
ref
,
nextTick
,
findComponentPropsData
,
toRaw
,
updateProps
,
hasQueueJob
,
invalidateJob
,
getExposeProxy
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
const
eventChannels
=
{};
const
eventChannelStack
=
[];
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
MP_METHODS
=
[
'
createSelectorQuery
'
,
'
createIntersectionObserver
'
,
...
...
@@ -103,8 +92,10 @@ function callHook(name, args) {
name
=
'
m
'
;
}
else
if
(
name
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
{
this
.
__eventChannel__
=
swan
.
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
}
const
hooks
=
this
.
$
[
name
];
return
hooks
&&
invokeArrayFns
(
hooks
,
args
);
...
...
packages/uni-mp-core/src/api/index.ts
浏览文件 @
5d683283
...
...
@@ -23,7 +23,7 @@ import { invokeCreateVueAppHook, onCreateVueApp } from '@dcloudio/uni-shared'
import
{
promisify
}
from
'
./promise
'
import
{
initWrapper
}
from
'
./wrapper
'
import
{
MPProtocols
}
from
'
./protocols
'
import
{
MPProtocols
,
getEventChannel
}
from
'
./protocols
'
import
{
getLocale
,
setLocale
,
onLocaleChange
}
from
'
./locale
'
const
baseApis
=
{
...
...
@@ -68,6 +68,10 @@ export function initUni(api: Record<string, any>, protocols: MPProtocols) {
if
(
__PLATFORM__
===
'
mp-alipay
'
)
{
__GLOBAL__
.
$emit
=
$emit
}
// 处理 api mp 打包后为不同js,getEventChannel 无法共享问题
if
(
__PLATFORM__
!==
'
mp-weixin
'
)
{
__GLOBAL__
.
getEventChannel
=
getEventChannel
}
return
new
Proxy
({},
UniProxyHandlers
)
}
packages/uni-mp-core/src/runtime/componentInstance.ts
浏览文件 @
5d683283
...
...
@@ -145,9 +145,14 @@ function callHook(this: ComponentPublicInstance, name: string, args?: unknown) {
callHook
.
call
(
this
,
'
bm
'
)
// beforeMount
this
.
$
.
isMounted
=
true
name
=
'
m
'
}
else
if
(
name
===
'
onLoad
'
&&
args
&&
(
args
as
any
).
__id__
)
{
;(
this
as
any
).
__eventChannel__
=
getEventChannel
((
args
as
any
).
__id__
)
delete
(
args
as
any
).
__id__
}
if
(
__PLATFORM__
!==
'
mp-weixin
'
)
{
if
(
name
===
'
onLoad
'
&&
args
&&
(
args
as
any
).
__id__
)
{
;(
this
as
any
).
__eventChannel__
=
__GLOBAL__
.
getEventChannel
(
(
args
as
any
).
__id__
)
delete
(
args
as
any
).
__id__
}
}
const
hooks
=
(
this
.
$
as
any
)[
name
]
return
hooks
&&
invokeArrayFns
(
hooks
,
args
)
...
...
packages/uni-mp-kuaishou/dist/uni.api.esm.js
浏览文件 @
5d683283
...
...
@@ -2,42 +2,6 @@ import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawTy
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
import
{
LINEFEED
,
Emitter
,
onCreateVueApp
,
invokeCreateVueAppHook
}
from
'
@dcloudio/uni-shared
'
;
const
eventChannels
=
{};
const
eventChannelStack
=
[];
let
id
=
0
;
function
initEventChannel
(
events
,
cache
=
true
)
{
id
++
;
const
eventChannel
=
new
ks
.
EventChannel
(
id
,
events
);
if
(
cache
)
{
eventChannels
[
id
]
=
eventChannel
;
eventChannelStack
.
push
(
eventChannel
);
}
return
eventChannel
;
}
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
navigateTo
=
{
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
();
},
};
function
getBaseSystemInfo
()
{
return
ks
.
getSystemInfoSync
()
}
...
...
@@ -915,67 +879,6 @@ if (typeof global !== 'undefined') {
global
.
getLocale
=
getLocale
;
}
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
ks
[
key
]));
},
};
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
useDeviceId
(
global
=
ks
)
{
...
...
@@ -1149,6 +1052,105 @@ const previewImage = {
},
};
const
eventChannels
=
{};
const
eventChannelStack
=
[];
let
id
=
0
;
function
initEventChannel
(
events
,
cache
=
true
)
{
id
++
;
const
eventChannel
=
new
ks
.
EventChannel
(
id
,
events
);
if
(
cache
)
{
eventChannels
[
id
]
=
eventChannel
;
eventChannelStack
.
push
(
eventChannel
);
}
return
eventChannel
;
}
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
navigateTo
=
{
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
();
},
};
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
ks
[
key
]));
},
};
// 处理 api mp 打包后为不同js,getEventChannel 无法共享问题
ks
.
getEventChannel
=
getEventChannel
;
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
const
getProvider
=
initGetProvider
({
oauth
:
[
'
kuaishou
'
],
share
:
[
'
kuaishou
'
],
...
...
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
浏览文件 @
5d683283
...
...
@@ -3,17 +3,6 @@ import { isArray, hasOwn, isFunction, extend, hyphenate, isPlainObject } from '@
import
{
ref
,
nextTick
,
findComponentPropsData
,
toRaw
,
updateProps
,
hasQueueJob
,
invalidateJob
,
getExposeProxy
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
const
eventChannels
=
{};
const
eventChannelStack
=
[];
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
MP_METHODS
=
[
'
createSelectorQuery
'
,
'
createIntersectionObserver
'
,
...
...
@@ -103,8 +92,10 @@ function callHook(name, args) {
name
=
'
m
'
;
}
else
if
(
name
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
{
this
.
__eventChannel__
=
ks
.
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
}
const
hooks
=
this
.
$
[
name
];
return
hooks
&&
invokeArrayFns
(
hooks
,
args
);
...
...
packages/uni-mp-lark/dist/uni.api.esm.js
浏览文件 @
5d683283
...
...
@@ -2,42 +2,6 @@ import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawTy
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
import
{
LINEFEED
,
Emitter
,
onCreateVueApp
,
invokeCreateVueAppHook
}
from
'
@dcloudio/uni-shared
'
;
const
eventChannels
=
{};
const
eventChannelStack
=
[];
let
id
=
0
;
function
initEventChannel
(
events
,
cache
=
true
)
{
id
++
;
const
eventChannel
=
new
tt
.
EventChannel
(
id
,
events
);
if
(
cache
)
{
eventChannels
[
id
]
=
eventChannel
;
eventChannelStack
.
push
(
eventChannel
);
}
return
eventChannel
;
}
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
navigateTo
=
{
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
();
},
};
function
getBaseSystemInfo
()
{
return
tt
.
getSystemInfoSync
()
}
...
...
@@ -915,67 +879,6 @@ if (typeof global !== 'undefined') {
global
.
getLocale
=
getLocale
;
}
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
tt
[
key
]));
},
};
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
useDeviceId
(
global
=
tt
)
{
...
...
@@ -1149,6 +1052,105 @@ const previewImage = {
},
};
const
eventChannels
=
{};
const
eventChannelStack
=
[];
let
id
=
0
;
function
initEventChannel
(
events
,
cache
=
true
)
{
id
++
;
const
eventChannel
=
new
tt
.
EventChannel
(
id
,
events
);
if
(
cache
)
{
eventChannels
[
id
]
=
eventChannel
;
eventChannelStack
.
push
(
eventChannel
);
}
return
eventChannel
;
}
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
navigateTo
=
{
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
();
},
};
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
tt
[
key
]));
},
};
// 处理 api mp 打包后为不同js,getEventChannel 无法共享问题
tt
.
getEventChannel
=
getEventChannel
;
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
const
getProvider
=
initGetProvider
({
oauth
:
[
'
toutiao
'
],
share
:
[
'
toutiao
'
],
...
...
packages/uni-mp-lark/dist/uni.mp.esm.js
浏览文件 @
5d683283
...
...
@@ -3,17 +3,6 @@ import { isArray, hasOwn, isFunction, extend, isPlainObject, isObject } from '@v
import
{
ref
,
nextTick
,
findComponentPropsData
,
toRaw
,
updateProps
,
hasQueueJob
,
invalidateJob
,
getExposeProxy
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
const
eventChannels
=
{};
const
eventChannelStack
=
[];
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
MP_METHODS
=
[
'
createSelectorQuery
'
,
'
createIntersectionObserver
'
,
...
...
@@ -99,8 +88,10 @@ function callHook(name, args) {
name
=
'
m
'
;
}
else
if
(
name
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
{
this
.
__eventChannel__
=
tt
.
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
}
const
hooks
=
this
.
$
[
name
];
return
hooks
&&
invokeArrayFns
(
hooks
,
args
);
...
...
packages/uni-mp-qq/dist/uni.api.esm.js
浏览文件 @
5d683283
...
...
@@ -2,42 +2,6 @@ import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawTy
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
import
{
LINEFEED
,
Emitter
,
onCreateVueApp
,
invokeCreateVueAppHook
}
from
'
@dcloudio/uni-shared
'
;
const
eventChannels
=
{};
const
eventChannelStack
=
[];
let
id
=
0
;
function
initEventChannel
(
events
,
cache
=
true
)
{
id
++
;
const
eventChannel
=
new
qq
.
EventChannel
(
id
,
events
);
if
(
cache
)
{
eventChannels
[
id
]
=
eventChannel
;
eventChannelStack
.
push
(
eventChannel
);
}
return
eventChannel
;
}
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
navigateTo
=
{
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
();
},
};
function
getBaseSystemInfo
()
{
return
qq
.
getSystemInfoSync
()
}
...
...
@@ -915,67 +879,6 @@ if (typeof global !== 'undefined') {
global
.
getLocale
=
getLocale
;
}
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
qq
[
key
]));
},
};
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
useDeviceId
(
global
=
qq
)
{
...
...
@@ -1147,6 +1050,105 @@ const previewImage = {
},
};
const
eventChannels
=
{};
const
eventChannelStack
=
[];
let
id
=
0
;
function
initEventChannel
(
events
,
cache
=
true
)
{
id
++
;
const
eventChannel
=
new
qq
.
EventChannel
(
id
,
events
);
if
(
cache
)
{
eventChannels
[
id
]
=
eventChannel
;
eventChannelStack
.
push
(
eventChannel
);
}
return
eventChannel
;
}
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
navigateTo
=
{
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
();
},
};
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
qq
[
key
]));
},
};
// 处理 api mp 打包后为不同js,getEventChannel 无法共享问题
qq
.
getEventChannel
=
getEventChannel
;
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
const
getProvider
=
initGetProvider
({
oauth
:
[
'
qq
'
],
share
:
[
'
qq
'
],
...
...
packages/uni-mp-qq/dist/uni.mp.esm.js
浏览文件 @
5d683283
...
...
@@ -3,17 +3,6 @@ import { isArray, hasOwn, isFunction, extend, isPlainObject } from '@vue/shared'
import
{
ref
,
findComponentPropsData
,
toRaw
,
updateProps
,
hasQueueJob
,
invalidateJob
,
getExposeProxy
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
const
eventChannels
=
{};
const
eventChannelStack
=
[];
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
MP_METHODS
=
[
'
createSelectorQuery
'
,
'
createIntersectionObserver
'
,
...
...
@@ -99,8 +88,10 @@ function callHook(name, args) {
name
=
'
m
'
;
}
else
if
(
name
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
{
this
.
__eventChannel__
=
qq
.
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
}
const
hooks
=
this
.
$
[
name
];
return
hooks
&&
invokeArrayFns
(
hooks
,
args
);
...
...
packages/uni-mp-toutiao/dist/uni.api.esm.js
浏览文件 @
5d683283
...
...
@@ -2,42 +2,6 @@ import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawTy
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
import
{
LINEFEED
,
Emitter
,
onCreateVueApp
,
invokeCreateVueAppHook
}
from
'
@dcloudio/uni-shared
'
;
const
eventChannels
=
{};
const
eventChannelStack
=
[];
let
id
=
0
;
function
initEventChannel
(
events
,
cache
=
true
)
{
id
++
;
const
eventChannel
=
new
tt
.
EventChannel
(
id
,
events
);
if
(
cache
)
{
eventChannels
[
id
]
=
eventChannel
;
eventChannelStack
.
push
(
eventChannel
);
}
return
eventChannel
;
}
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
navigateTo
=
{
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
();
},
};
function
getBaseSystemInfo
()
{
return
tt
.
getSystemInfoSync
()
}
...
...
@@ -915,67 +879,6 @@ if (typeof global !== 'undefined') {
global
.
getLocale
=
getLocale
;
}
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
tt
[
key
]));
},
};
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
useDeviceId
(
global
=
tt
)
{
...
...
@@ -1149,6 +1052,105 @@ const previewImage = {
},
};
const
eventChannels
=
{};
const
eventChannelStack
=
[];
let
id
=
0
;
function
initEventChannel
(
events
,
cache
=
true
)
{
id
++
;
const
eventChannel
=
new
tt
.
EventChannel
(
id
,
events
);
if
(
cache
)
{
eventChannels
[
id
]
=
eventChannel
;
eventChannelStack
.
push
(
eventChannel
);
}
return
eventChannel
;
}
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
navigateTo
=
{
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
();
},
};
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
tt
[
key
]));
},
};
// 处理 api mp 打包后为不同js,getEventChannel 无法共享问题
tt
.
getEventChannel
=
getEventChannel
;
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
const
getProvider
=
initGetProvider
({
oauth
:
[
'
toutiao
'
],
share
:
[
'
toutiao
'
],
...
...
packages/uni-mp-toutiao/dist/uni.mp.esm.js
浏览文件 @
5d683283
...
...
@@ -3,17 +3,6 @@ import { isArray, hasOwn, isFunction, extend, isPlainObject, isObject } from '@v
import
{
ref
,
nextTick
,
findComponentPropsData
,
toRaw
,
updateProps
,
hasQueueJob
,
invalidateJob
,
getExposeProxy
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
const
eventChannels
=
{};
const
eventChannelStack
=
[];
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
MP_METHODS
=
[
'
createSelectorQuery
'
,
'
createIntersectionObserver
'
,
...
...
@@ -99,8 +88,10 @@ function callHook(name, args) {
name
=
'
m
'
;
}
else
if
(
name
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
{
this
.
__eventChannel__
=
tt
.
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
}
const
hooks
=
this
.
$
[
name
];
return
hooks
&&
invokeArrayFns
(
hooks
,
args
);
...
...
packages/uni-mp-weixin/dist/uni.api.esm.js
浏览文件 @
5d683283
import
{
isArray
,
hasOwn
,
isString
,
isPlainObject
,
isObject
,
capitalize
,
toRawType
,
makeMap
,
isFunction
,
isPromise
,
extend
,
remove
}
from
'
@vue/shared
'
;
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
import
{
LINEFEED
,
Emitter
,
onCreateVueApp
,
invokeCreateVueAppHook
,
sortObject
}
from
'
@dcloudio/uni-shared
'
;
import
{
LINEFEED
,
Emitter
,
sortObject
,
onCreateVueApp
,
invokeCreateVueAppHook
}
from
'
@dcloudio/uni-shared
'
;
function
getBaseSystemInfo
()
{
return
wx
.
getSystemInfoSync
()
...
...
@@ -879,67 +879,6 @@ if (typeof global !== 'undefined') {
global
.
getLocale
=
getLocale
;
}
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
wx
[
key
]));
},
};
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
useDeviceId
(
global
=
wx
)
{
...
...
@@ -1181,6 +1120,67 @@ const getAppAuthorizeSetting = {
},
};
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
wx
[
key
]));
},
};
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
const
mocks
=
[
'
__route__
'
,
'
__wxExparserNodeId__
'
,
'
__wxWebviewId__
'
];
const
getProvider
=
initGetProvider
({
...
...
packages/uni-mp-weixin/dist/uni.mp.esm.js
浏览文件 @
5d683283
...
...
@@ -3,17 +3,6 @@ import { isArray, hasOwn, isFunction, extend, isPlainObject } from '@vue/shared'
import
{
ref
,
findComponentPropsData
,
toRaw
,
updateProps
,
hasQueueJob
,
invalidateJob
,
getExposeProxy
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
const
eventChannels
=
{};
const
eventChannelStack
=
[];
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
MP_METHODS
=
[
'
createSelectorQuery
'
,
'
createIntersectionObserver
'
,
...
...
@@ -98,10 +87,6 @@ function callHook(name, args) {
this
.
$
.
isMounted
=
true
;
name
=
'
m
'
;
}
else
if
(
name
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
const
hooks
=
this
.
$
[
name
];
return
hooks
&&
invokeArrayFns
(
hooks
,
args
);
}
...
...
packages/uni-quickapp-webview/dist/uni.api.esm.js
浏览文件 @
5d683283
...
...
@@ -2,42 +2,6 @@ import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawTy
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
import
{
LINEFEED
,
Emitter
,
onCreateVueApp
,
invokeCreateVueAppHook
}
from
'
@dcloudio/uni-shared
'
;
const
eventChannels
=
{};
const
eventChannelStack
=
[];
let
id
=
0
;
function
initEventChannel
(
events
,
cache
=
true
)
{
id
++
;
const
eventChannel
=
new
qa
.
EventChannel
(
id
,
events
);
if
(
cache
)
{
eventChannels
[
id
]
=
eventChannel
;
eventChannelStack
.
push
(
eventChannel
);
}
return
eventChannel
;
}
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
navigateTo
=
{
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
();
},
};
function
getBaseSystemInfo
()
{
return
qa
.
getSystemInfoSync
()
}
...
...
@@ -915,67 +879,6 @@ if (typeof global !== 'undefined') {
global
.
getLocale
=
getLocale
;
}
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
qa
[
key
]));
},
};
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
useDeviceId
(
global
=
qa
)
{
...
...
@@ -1146,6 +1049,105 @@ const previewImage = {
},
};
const
eventChannels
=
{};
const
eventChannelStack
=
[];
let
id
=
0
;
function
initEventChannel
(
events
,
cache
=
true
)
{
id
++
;
const
eventChannel
=
new
qa
.
EventChannel
(
id
,
events
);
if
(
cache
)
{
eventChannels
[
id
]
=
eventChannel
;
eventChannelStack
.
push
(
eventChannel
);
}
return
eventChannel
;
}
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
navigateTo
=
{
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
();
},
};
const
baseApis
=
{
$on
,
$off
,
$once
,
$emit
,
upx2px
,
interceptors
,
addInterceptor
,
removeInterceptor
,
onCreateVueApp
,
invokeCreateVueAppHook
,
getLocale
,
setLocale
,
onLocaleChange
,
getPushClientId
,
onPushMessage
,
offPushMessage
,
invokePushCallback
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
const
UniProxyHandlers
=
{
get
(
target
,
key
)
{
if
(
hasOwn
(
target
,
key
))
{
return
target
[
key
];
}
if
(
hasOwn
(
api
,
key
))
{
return
promisify
(
key
,
api
[
key
]);
}
if
(
hasOwn
(
baseApis
,
key
))
{
return
promisify
(
key
,
baseApis
[
key
]);
}
// event-api
// provider-api?
return
promisify
(
key
,
wrapper
(
key
,
qa
[
key
]));
},
};
// 处理 api mp 打包后为不同js,getEventChannel 无法共享问题
qa
.
getEventChannel
=
getEventChannel
;
return
new
Proxy
({},
UniProxyHandlers
);
}
function
initGetProvider
(
providers
)
{
return
function
getProvider
({
service
,
success
,
fail
,
complete
,
})
{
let
res
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
],
};
isFunction
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
,
};
isFunction
(
fail
)
&&
fail
(
res
);
}
isFunction
(
complete
)
&&
complete
(
res
);
};
}
const
providers
=
{
oauth
:
[],
share
:
[],
...
...
packages/uni-quickapp-webview/dist/uni.mp.esm.js
浏览文件 @
5d683283
...
...
@@ -3,17 +3,6 @@ import { isArray, hasOwn, isFunction, extend, isPlainObject, isObject } from '@v
import
{
ref
,
nextTick
,
findComponentPropsData
,
toRaw
,
updateProps
,
hasQueueJob
,
invalidateJob
,
getExposeProxy
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
normalizeLocale
,
LOCALE_EN
}
from
'
@dcloudio/uni-i18n
'
;
const
eventChannels
=
{};
const
eventChannelStack
=
[];
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
;
}
return
eventChannelStack
.
shift
();
}
const
MP_METHODS
=
[
'
createSelectorQuery
'
,
'
createIntersectionObserver
'
,
...
...
@@ -99,8 +88,10 @@ function callHook(name, args) {
name
=
'
m
'
;
}
else
if
(
name
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
{
this
.
__eventChannel__
=
qa
.
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
}
const
hooks
=
this
.
$
[
name
];
return
hooks
&&
invokeArrayFns
(
hooks
,
args
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录