Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qianlong66
uni-app
提交
4d63d070
U
uni-app
项目概览
qianlong66
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4d63d070
编写于
8月 05, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(app): launch without interceptor
上级
a2a08763
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
863 addition
and
839 deletion
+863
-839
packages/uni-api/src/helpers/api/index.ts
packages/uni-api/src/helpers/api/index.ts
+9
-7
packages/uni-api/src/index.ts
packages/uni-api/src/index.ts
+4
-0
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+790
-787
packages/uni-app-plus/src/service/api/index.ts
packages/uni-app-plus/src/service/api/index.ts
+2
-2
packages/uni-app-plus/src/service/api/route/navigateTo.ts
packages/uni-app-plus/src/service/api/route/navigateTo.ts
+30
-24
packages/uni-app-plus/src/service/api/route/switchTab.ts
packages/uni-app-plus/src/service/api/route/switchTab.ts
+23
-17
packages/uni-app-plus/src/service/framework/app/subscriber/webviewReady.ts
...plus/src/service/framework/app/subscriber/webviewReady.ts
+5
-2
未找到文件。
packages/uni-api/src/helpers/api/index.ts
浏览文件 @
4d63d070
...
...
@@ -233,15 +233,17 @@ export function defineSyncApi<T extends ApiLike>(
)
as
unknown
as
T
}
export
type
DefineAsyncApiFn
<
T
extends
AsyncApiLike
,
P
=
AsyncApiOptions
<
T
>>
=
(
args
:
P
extends
undefined
?
undefined
:
Omit
<
P
,
CALLBACK_TYPES
>
,
res
:
{
resolve
:
(
res
:
AsyncApiRes
<
P
>
|
void
)
=>
void
reject
:
(
errMsg
?:
string
,
errRes
?:
any
)
=>
void
}
)
=>
void
export
function
defineAsyncApi
<
T
extends
AsyncApiLike
,
P
=
AsyncApiOptions
<
T
>>
(
name
:
string
,
fn
:
(
args
:
P
extends
undefined
?
undefined
:
Omit
<
P
,
CALLBACK_TYPES
>
,
res
:
{
resolve
:
(
res
:
AsyncApiRes
<
P
>
|
void
)
=>
void
reject
:
(
errMsg
?:
string
,
errRes
?:
any
)
=>
void
}
)
=>
void
,
fn
:
DefineAsyncApiFn
<
T
>
,
protocol
?:
ApiProtocols
<
T
>
,
options
?:
ApiOptions
<
T
>
)
{
...
...
packages/uni-api/src/index.ts
浏览文件 @
4d63d070
...
...
@@ -114,3 +114,7 @@ export {
export
{
handlePromise
}
from
'
./helpers/api/promise
'
export
{
invokeApi
,
wrapperReturnValue
}
from
'
./helpers/interceptor
'
export
{
requestComponentObserver
}
from
'
./helpers/requestComponentObserver
'
// types
export
{
DefineAsyncApiFn
}
from
'
./helpers/api
'
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
4d63d070
此差异已折叠。
点击以展开。
packages/uni-app-plus/src/service/api/index.ts
浏览文件 @
4d63d070
...
...
@@ -68,10 +68,10 @@ export * from './ad/interstitialAd'
export
*
from
'
./ad/interactiveAd
'
export
*
from
'
./route/navigateBack
'
export
*
from
'
./route/navigateTo
'
export
{
navigateTo
}
from
'
./route/navigateTo
'
export
*
from
'
./route/redirectTo
'
export
*
from
'
./route/reLaunch
'
export
*
from
'
./route/switchTab
'
export
{
switchTab
}
from
'
./route/switchTab
'
export
*
from
'
./route/preloadPage
'
export
{
...
...
packages/uni-app-plus/src/service/api/route/navigateTo.ts
浏览文件 @
4d63d070
...
...
@@ -4,6 +4,7 @@ import {
API_NAVIGATE_TO
,
API_TYPE_NAVIGATE_TO
,
defineAsyncApi
,
DefineAsyncApiFn
,
NavigateToOptions
,
NavigateToProtocol
,
}
from
'
@dcloudio/uni-api
'
...
...
@@ -13,32 +14,37 @@ import { navigate, RouteOptions } from './utils'
import
{
showWebview
}
from
'
./webview
'
import
{
registerPage
}
from
'
../../framework/page
'
export
const
$navigateTo
:
DefineAsyncApiFn
<
API_TYPE_NAVIGATE_TO
>
=
(
args
,
{
resolve
,
reject
}
)
=>
{
const
{
url
,
animationType
,
animationDuration
}
=
args
const
{
path
,
query
}
=
parseUrl
(
url
)
const
[
aniType
,
aniDuration
]
=
initAnimation
(
path
,
animationType
,
animationDuration
)
navigate
(
path
,
()
=>
{
_navigateTo
({
url
,
path
,
query
,
aniType
,
aniDuration
,
})
.
then
(
resolve
)
.
catch
(
reject
)
},
(
args
as
any
).
openType
===
'
appLaunch
'
)
}
export
const
navigateTo
=
defineAsyncApi
<
API_TYPE_NAVIGATE_TO
>
(
API_NAVIGATE_TO
,
(
args
,
{
resolve
,
reject
})
=>
{
const
{
url
,
animationType
,
animationDuration
}
=
args
const
{
path
,
query
}
=
parseUrl
(
url
)
const
[
aniType
,
aniDuration
]
=
initAnimation
(
path
,
animationType
,
animationDuration
)
navigate
(
path
,
()
=>
{
_navigateTo
({
url
,
path
,
query
,
aniType
,
aniDuration
,
})
.
then
(
resolve
)
.
catch
(
reject
)
},
(
args
as
any
).
openType
===
'
appLaunch
'
)
},
$navigateTo
,
NavigateToProtocol
,
NavigateToOptions
)
...
...
packages/uni-app-plus/src/service/api/route/switchTab.ts
浏览文件 @
4d63d070
...
...
@@ -2,6 +2,7 @@ import {
API_SWITCH_TAB
,
API_TYPE_SWITCH_TAB
,
defineAsyncApi
,
DefineAsyncApiFn
,
SwitchTabOptions
,
SwitchTabProtocol
,
}
from
'
@dcloudio/uni-api
'
...
...
@@ -16,25 +17,30 @@ import { setStatusBarStyle } from '../../statusBar'
import
{
closePage
,
navigate
,
RouteOptions
}
from
'
./utils
'
import
{
closeWebview
,
showWebview
}
from
'
./webview
'
export
const
$switchTab
:
DefineAsyncApiFn
<
API_TYPE_SWITCH_TAB
>
=
(
args
,
{
resolve
,
reject
}
)
=>
{
const
{
url
}
=
args
const
{
path
,
query
}
=
parseUrl
(
url
)
navigate
(
path
,
()
=>
{
_switchTab
({
url
,
path
,
query
,
})
.
then
(
resolve
)
.
catch
(
reject
)
},
(
args
as
any
).
openType
===
'
appLaunch
'
)
}
export
const
switchTab
=
defineAsyncApi
<
API_TYPE_SWITCH_TAB
>
(
API_SWITCH_TAB
,
(
args
,
{
resolve
,
reject
})
=>
{
const
{
url
}
=
args
const
{
path
,
query
}
=
parseUrl
(
url
)
navigate
(
path
,
()
=>
{
_switchTab
({
url
,
path
,
query
,
})
.
then
(
resolve
)
.
catch
(
reject
)
},
(
args
as
any
).
openType
===
'
appLaunch
'
)
},
$switchTab
,
SwitchTabProtocol
,
SwitchTabOptions
)
...
...
packages/uni-app-plus/src/service/framework/app/subscriber/webviewReady.ts
浏览文件 @
4d63d070
import
{
getRouteOptions
}
from
'
@dcloudio/uni-core
'
import
{
ON_WEBVIEW_READY
}
from
'
../../../../constants
'
import
{
$navigateTo
}
from
'
../../../api/route/navigateTo
'
import
{
$switchTab
}
from
'
../../../api/route/switchTab
'
import
{
preloadWebview
,
setPreloadWebview
}
from
'
../../webview
'
let
isLaunchWebviewReady
=
false
// 目前首页双向确定 ready,可能会导致触发两次 onWebviewReady(主要是 Android)
...
...
@@ -42,9 +44,10 @@ function onLaunchWebviewReady() {
url
:
entryPagePath
+
(
__uniConfig
.
entryPageQuery
||
''
),
openType
:
'
appLaunch
'
,
}
const
handler
=
{
resolve
()
{},
reject
()
{}
}
if
(
routeOptions
.
meta
.
isTabBar
)
{
return
uni
.
switchTab
(
args
)
return
$switchTab
(
args
,
handler
)
}
return
uni
.
navigateTo
(
args
)
return
$navigateTo
(
args
,
handler
)
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录