Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ChenYFan_OHHH
uni-app
提交
51251932
U
uni-app
项目概览
ChenYFan_OHHH
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
51251932
编写于
5月 20, 2021
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: preloadPage
上级
b57f0a46
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
68 addition
and
3 deletion
+68
-3
packages/shims-uni-app.d.ts
packages/shims-uni-app.d.ts
+1
-0
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+8
-1
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+27
-2
packages/uni-h5/src/service/api/index.ts
packages/uni-h5/src/service/api/index.ts
+1
-0
packages/uni-h5/src/service/api/route/preloadPage.ts
packages/uni-h5/src/service/api/route/preloadPage.ts
+31
-0
未找到文件。
packages/shims-uni-app.d.ts
浏览文件 @
51251932
...
...
@@ -50,6 +50,7 @@ declare namespace UniApp {
alias
?:
string
meta
:
PageRouteMeta
component
?:
any
loader
:
()
=>
Promise
<
any
>
}
type
UniRoutes
=
UniRoute
[]
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
51251932
...
...
@@ -2838,7 +2838,14 @@ const props$j = /* @__PURE__ */ Object.assign({}, {
default
:
"
done
"
}
},
props$m
);
const
emit
=
[
"
input
"
,
"
focus
"
,
"
blur
"
,
"
update:value
"
,
"
update:modelValue
"
,
...
emit$1
];
const
emit
=
[
"
input
"
,
"
focus
"
,
"
blur
"
,
"
update:value
"
,
"
update:modelValue
"
,
...
emit$1
];
function
useBase
(
props2
,
rootRef
,
emit2
)
{
const
fieldRef
=
vue
.
ref
(
null
);
const
trigger
=
useCustomEvent
(
rootRef
,
emit2
);
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
51251932
...
...
@@ -4602,7 +4602,14 @@ const props$q = /* @__PURE__ */ Object.assign({}, {
default: "done"
}
}, props$t);
const emit = ["input", "focus", "blur", "update:value", "update:modelValue", ...emit$1];
const emit = [
"input",
"focus",
"blur",
"update:value",
"update:modelValue",
...emit$1
];
function useBase(props2, rootRef, emit2) {
const fieldRef = ref(null);
const trigger = useCustomEvent(rootRef, emit2);
...
...
@@ -11886,6 +11893,7 @@ const NavigateBackProtocol = /* @__PURE__ */ extend({
const RedirectToProtocol = BaseRouteProtocol;
const ReLaunchProtocol = BaseRouteProtocol;
const SwitchTabProtocol = BaseRouteProtocol;
const PreloadPageProtocol = BaseRouteProtocol;
const NavigateToOptions = /* @__PURE__ */ createRouteOptions(API_NAVIGATE_TO);
const RedirectToOptions = /* @__PURE__ */ createRouteOptions(API_REDIRECT_TO);
const ReLaunchOptions = /* @__PURE__ */ createRouteOptions(API_RE_LAUNCH);
...
...
@@ -16958,6 +16966,22 @@ function getTabBarPageId(url) {
const switchTab = /* @__PURE__ */ defineAsyncApi(API_SWITCH_TAB, ({url}, {resolve, reject}) => {
return removeNonTabBarPages(), navigate(API_SWITCH_TAB, url, getTabBarPageId(url)).then(resolve).catch(reject);
}, SwitchTabProtocol, SwitchTabOptions);
const preloadPage = /* @__PURE__ */ defineAsyncApi(API_PRELOAD_PAGE, ({url}, {resolve, reject}) => {
const path = url.split("?")[0];
const route = __uniRoutes.find((item) => item.path === path);
if (!route) {
reject(`${url}}`);
return;
}
route.loader && route.loader().then(() => {
resolve({
url,
errMsg: "preloadPage:ok"
});
}).catch((err) => {
reject(`${url} ${String(err)}`);
});
}, PreloadPageProtocol);
const props$3 = {
title: {
type: String,
...
...
@@ -17790,6 +17814,7 @@ var api = /* @__PURE__ */ Object.freeze({
redirectTo,
reLaunch,
switchTab,
preloadPage,
showModal,
showToast,
showLoading,
...
...
@@ -20169,4 +20194,4 @@ var index = /* @__PURE__ */ defineSystemComponent({
return openBlock(), createBlock("div", clazz, [loadingVNode]);
}
});
export {$emit, $off, $on, $once, index$1 as AsyncErrorComponent, index as AsyncLoadingComponent, _sfc_main$8 as Audio, index$m as Button, _sfc_main$7 as Canvas, index$k as Checkbox, index$l as CheckboxGroup, _sfc_main$2 as CoverImage, _sfc_main$3 as CoverView, index$j as Editor, index$o as Form, Friction, index$i as Icon, index$h as Image, Input, index$n as Label, LayoutComponent, Map$1 as Map, MovableArea, MovableView, _sfc_main$6 as Navigator, index$2 as PageComponent, _sfc_main$1 as Picker, PickerView, PickerViewColumn, index$g as Progress, index$e as Radio, index$f as RadioGroup, ResizeSensor, _sfc_main$5 as RichText, _sfc_main$4 as ScrollView, Scroller, index$d as Slider, Spring, Swiper, SwiperItem, index$c as Switch, index$b as Text, index$a as Textarea, UniServiceJSBridge$1 as UniServiceJSBridge, UniViewJSBridge$1 as UniViewJSBridge, index$5 as Video, index$9 as View, index$4 as WebView, addInterceptor, arrayBufferToBase64, base64ToArrayBuffer, canIUse, canvasGetImageData, canvasPutImageData, canvasToTempFilePath, chooseFile, chooseImage, chooseLocation, chooseVideo, clearStorage, clearStorageSync, closeSocket, connectSocket, createAnimation, createCanvasContext, createInnerAudioContext, createIntersectionObserver, createMapContext, createSelectorQuery, createVideoContext, cssBackdropFilter, cssConstant, cssEnv, cssVar, defineBuiltInComponent, defineSystemComponent, disableScrollBounce, downloadFile, getApp$1 as getApp, getContextInfo, getCurrentPages$1 as getCurrentPages, getFileInfo, getImageInfo, getLocation, getNetworkType, getSelectedTextRange, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getVideoInfo, hideKeyboard, hideLoading, hideNavigationBarLoading, hideTabBar, hideTabBarRedDot, hideToast, initScrollBounce, loadFontFace, makePhoneCall, navigateBack, navigateTo, offAccelerometerChange, offCompassChange, offNetworkStatusChange, offWindowResize, onAccelerometerChange, onCompassChange, onNetworkStatusChange, onSocketClose, onSocketError, onSocketMessage, onSocketOpen, onTabBarMidButtonTap, onWindowResize, openDocument, openLocation, pageScrollTo, index$6 as plugin, previewImage, promiseInterceptor, reLaunch, redirectTo, removeInterceptor, removeStorage, removeStorageSync, removeTabBarBadge, request, sendSocketMessage, setNavigationBarColor, setNavigationBarTitle, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setupApp, setupPage, showActionSheet, showLoading, showModal, showNavigationBarLoading, showTabBar, showTabBarRedDot, showToast, startAccelerometer, startCompass, startPullDownRefresh, stopAccelerometer, stopCompass, stopPullDownRefresh, switchTab, uni$1 as uni, uniFormKey, uploadFile, upx2px, useAttrs, useBooleanAttr, useContextInfo, useCustomEvent, useNativeEvent, useOn, useScroller, useSubscribe, useTouchtrack, useUserAction, vibrateLong, vibrateShort, withWebEvent};
export {$emit, $off, $on, $once, index$1 as AsyncErrorComponent, index as AsyncLoadingComponent, _sfc_main$8 as Audio, index$m as Button, _sfc_main$7 as Canvas, index$k as Checkbox, index$l as CheckboxGroup, _sfc_main$2 as CoverImage, _sfc_main$3 as CoverView, index$j as Editor, index$o as Form, Friction, index$i as Icon, index$h as Image, Input, index$n as Label, LayoutComponent, Map$1 as Map, MovableArea, MovableView, _sfc_main$6 as Navigator, index$2 as PageComponent, _sfc_main$1 as Picker, PickerView, PickerViewColumn, index$g as Progress, index$e as Radio, index$f as RadioGroup, ResizeSensor, _sfc_main$5 as RichText, _sfc_main$4 as ScrollView, Scroller, index$d as Slider, Spring, Swiper, SwiperItem, index$c as Switch, index$b as Text, index$a as Textarea, UniServiceJSBridge$1 as UniServiceJSBridge, UniViewJSBridge$1 as UniViewJSBridge, index$5 as Video, index$9 as View, index$4 as WebView, addInterceptor, arrayBufferToBase64, base64ToArrayBuffer, canIUse, canvasGetImageData, canvasPutImageData, canvasToTempFilePath, chooseFile, chooseImage, chooseLocation, chooseVideo, clearStorage, clearStorageSync, closeSocket, connectSocket, createAnimation, createCanvasContext, createInnerAudioContext, createIntersectionObserver, createMapContext, createSelectorQuery, createVideoContext, cssBackdropFilter, cssConstant, cssEnv, cssVar, defineBuiltInComponent, defineSystemComponent, disableScrollBounce, downloadFile, getApp$1 as getApp, getContextInfo, getCurrentPages$1 as getCurrentPages, getFileInfo, getImageInfo, getLocation, getNetworkType, getSelectedTextRange, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getVideoInfo, hideKeyboard, hideLoading, hideNavigationBarLoading, hideTabBar, hideTabBarRedDot, hideToast, initScrollBounce, loadFontFace, makePhoneCall, navigateBack, navigateTo, offAccelerometerChange, offCompassChange, offNetworkStatusChange, offWindowResize, onAccelerometerChange, onCompassChange, onNetworkStatusChange, onSocketClose, onSocketError, onSocketMessage, onSocketOpen, onTabBarMidButtonTap, onWindowResize, openDocument, openLocation, pageScrollTo, index$6 as plugin, pre
loadPage, pre
viewImage, promiseInterceptor, reLaunch, redirectTo, removeInterceptor, removeStorage, removeStorageSync, removeTabBarBadge, request, sendSocketMessage, setNavigationBarColor, setNavigationBarTitle, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setupApp, setupPage, showActionSheet, showLoading, showModal, showNavigationBarLoading, showTabBar, showTabBarRedDot, showToast, startAccelerometer, startCompass, startPullDownRefresh, stopAccelerometer, stopCompass, stopPullDownRefresh, switchTab, uni$1 as uni, uniFormKey, uploadFile, upx2px, useAttrs, useBooleanAttr, useContextInfo, useCustomEvent, useNativeEvent, useOn, useScroller, useSubscribe, useTouchtrack, useUserAction, vibrateLong, vibrateShort, withWebEvent};
packages/uni-h5/src/service/api/index.ts
浏览文件 @
51251932
...
...
@@ -48,6 +48,7 @@ export * from './route/navigateTo'
export
*
from
'
./route/redirectTo
'
export
*
from
'
./route/reLaunch
'
export
*
from
'
./route/switchTab
'
export
*
from
'
./route/preloadPage
'
export
*
from
'
./ui/popup/showModal
'
export
*
from
'
./ui/popup/showToast
'
...
...
packages/uni-h5/src/service/api/route/preloadPage.ts
0 → 100644
浏览文件 @
51251932
import
{
API_PRELOAD_PAGE
,
API_TYPE_PRELOAD_PAGE
,
PreloadPageProtocol
,
defineAsyncApi
,
}
from
'
@dcloudio/uni-api
'
export
const
preloadPage
=
defineAsyncApi
<
API_TYPE_PRELOAD_PAGE
>
(
API_PRELOAD_PAGE
,
({
url
},
{
resolve
,
reject
})
=>
{
const
path
=
url
.
split
(
'
?
'
)[
0
]
const
route
=
__uniRoutes
.
find
((
item
)
=>
item
.
path
===
path
)
if
(
!
route
)
{
reject
(
`
${
url
}
}`
)
return
}
route
.
loader
&&
route
.
loader
()
.
then
(()
=>
{
resolve
({
url
,
errMsg
:
'
preloadPage:ok
'
,
})
})
.
catch
((
err
:
any
)
=>
{
reject
(
`
${
url
}
${
String
(
err
)}
`
)
})
},
PreloadPageProtocol
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录