Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lzb_79
uni-app
提交
a86e108a
U
uni-app
项目概览
lzb_79
/
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,发现更多精彩内容 >>
提交
a86e108a
编写于
4月 15, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: uni.reLaunch
上级
39f9f408
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
1105 addition
and
28 deletion
+1105
-28
packages/uni-api/src/protocols/route/route.ts
packages/uni-api/src/protocols/route/route.ts
+3
-0
packages/uni-h5/dist/uni-h5.esm.js
packages/uni-h5/dist/uni-h5.esm.js
+199
-6
packages/uni-h5/src/framework/plugin/app.ts
packages/uni-h5/src/framework/plugin/app.ts
+0
-5
packages/uni-h5/src/framework/plugin/page.ts
packages/uni-h5/src/framework/plugin/page.ts
+4
-5
packages/uni-h5/src/framework/plugin/provide/page.ts
packages/uni-h5/src/framework/plugin/provide/page.ts
+3
-3
packages/uni-h5/src/service/api/route/reLaunch.ts
packages/uni-h5/src/service/api/route/reLaunch.ts
+5
-2
packages/uni-shared/dist/uni-shared.cjs.js
packages/uni-shared/dist/uni-shared.cjs.js
+7
-1
packages/uni-shared/dist/uni-shared.d.ts
packages/uni-shared/dist/uni-shared.d.ts
+2
-0
packages/uni-shared/dist/uni-shared.esm.js
packages/uni-shared/dist/uni-shared.esm.js
+7
-2
yarn.lock
yarn.lock
+875
-4
未找到文件。
packages/uni-api/src/protocols/route/route.ts
浏览文件 @
a86e108a
...
...
@@ -133,6 +133,9 @@ function createRouteOptions(type: string): ApiOptions<API_TYPE_NAVIGATE_TO> {
function
createNormalizeUrl
(
type
:
string
)
{
return
function
normalizeUrl
(
url
:
string
,
params
:
Record
<
string
,
any
>
)
{
if
(
!
url
)
{
return
`Missing required args: "url"`
}
// 格式化为绝对路径路由
url
=
getRealRoute
(
url
)
const
pagePath
=
url
.
split
(
'
?
'
)[
0
]
...
...
packages/uni-h5/dist/uni-h5.esm.js
浏览文件 @
a86e108a
import
{
isFunction
,
extend
,
isPlainObject
,
isString
,
invokeArrayFns
as
invokeArrayFns$1
,
hyphenate
,
isArray
,
hasOwn
as
hasOwn$1
,
isObject
as
isObject$1
,
capitalize
,
toRawType
,
makeMap
as
makeMap$1
,
isPromise
}
from
"
@vue/shared
"
;
import
{
injectHook
,
createVNode
,
inject
,
provide
,
reactive
,
computed
,
nextTick
,
getCurrentInstance
,
onBeforeMount
,
onMounted
,
onBeforeActivate
,
onBeforeDeactivate
,
openBlock
,
createBlock
,
mergeProps
,
toDisplayString
,
ref
,
defineComponent
,
resolveComponent
,
toHandlers
,
renderSlot
,
createCommentVNode
,
onBeforeUnmount
,
withModifiers
,
withDirectives
,
vShow
,
vModelDynamic
,
createTextVNode
,
Fragment
,
renderList
,
vModelText
,
watch
,
watchEffect
,
withCtx
,
KeepAlive
,
resolveDynamicComponent
}
from
"
vue
"
;
import
{
passive
,
invokeArrayFns
,
NAVBAR_HEIGHT
,
removeLeadingSlash
,
parseQuery
,
decodedQuery
,
plusReady
,
debounce
,
PRIMARY_COLOR
as
PRIMARY_COLOR$1
,
getLen
}
from
"
@dcloudio/uni-shared
"
;
import
{
passive
,
invokeArrayFns
,
NAVBAR_HEIGHT
,
removeLeadingSlash
,
parseQuery
,
decodedQuery
,
plusReady
,
debounce
,
PRIMARY_COLOR
as
PRIMARY_COLOR$1
,
getLen
,
updateElementStyle
}
from
"
@dcloudio/uni-shared
"
;
import
{
useRoute
,
createRouter
,
createWebHistory
,
createWebHashHistory
,
isNavigationFailure
,
RouterView
}
from
"
vue-router
"
;
function
applyOptions
(
options
,
instance2
,
publicThis
)
{
Object
.
keys
(
options
).
forEach
((
name
)
=>
{
...
...
@@ -1101,8 +1101,9 @@ function normalizePageMeta(pageMeta) {
navigationBar
.
backButton
=
pageMeta
.
isQuit
?
false
:
true
;
navigationBar
.
titleColor
=
navigationBar
.
titleColor
||
"
#fff
"
;
navigationBar
.
backgroundColor
=
navigationBar
.
backgroundColor
||
"
#F7F7F7
"
;
if
(
__UNI_FEATURE_PAGES__
)
{
if
(
history
.
state
&&
history
.
state
.
__type__
===
"
redirectTo
"
&&
getCurrentPages
().
length
===
0
)
{
if
(
__UNI_FEATURE_PAGES__
&&
history
.
state
)
{
const
type
=
history
.
state
.
__type__
;
if
((
type
===
"
redirectTo
"
||
type
===
"
reLaunch
"
)
&&
getCurrentPages
().
length
===
0
)
{
pageMeta
.
isEntry
=
true
;
pageMeta
.
isQuit
=
true
;
}
...
...
@@ -1160,6 +1161,9 @@ function getCurrentPages$1(isAll = false) {
pruneCurrentPages
();
return
[...
currentPagesMap
.
values
()];
}
function
removeAllCurrentPages
()
{
removeCurrentPages
(
getCurrentPages$1
(
true
).
length
,
true
);
}
function
removeCurrentPages
(
delta
=
1
,
removeRouteCaches
=
false
)
{
const
keys
=
[...
currentPagesMap
.
keys
()];
const
start
=
keys
.
length
-
1
;
...
...
@@ -3731,6 +3735,7 @@ const isIOS$1 = /iphone|ipad|ipod/i.test(ua);
const
isWindows
=
ua
.
match
(
/Windows NT
([\d
|
\d
.
\d]
*
)
/i
);
const
isMac
=
/Macintosh|Mac/i
.
test
(
ua
);
const
isLinux
=
/Linux|X11/i
.
test
(
ua
);
const
isIPadOS
=
isMac
&&
navigator
.
maxTouchPoints
>
0
;
function
getScreenFix
()
{
return
/^Apple/
.
test
(
navigator
.
vendor
)
&&
typeof
window
.
orientation
===
"
number
"
;
}
...
...
@@ -3803,6 +3808,7 @@ function decode(base64) {
}
return
arraybuffer
;
}
const
CHOOSE_SOURCE_TYPES
=
[
"
album
"
,
"
camera
"
];
const
HTTP_METHODS
=
[
"
GET
"
,
"
OPTIONS
"
,
...
...
@@ -3814,11 +3820,17 @@ const HTTP_METHODS = [
"
CONNECT
"
];
function
elemInArray
(
str
,
arr
)
{
if
(
arr
.
indexOf
(
str
)
===
-
1
)
{
if
(
!
str
||
arr
.
indexOf
(
str
)
===
-
1
)
{
return
arr
[
0
];
}
return
str
;
}
function
elemsInArray
(
strArr
,
optionalVal
)
{
if
(
!
isArray
(
strArr
)
||
strArr
.
length
===
0
||
strArr
.
find
((
val
)
=>
optionalVal
.
indexOf
(
val
)
===
-
1
))
{
return
optionalVal
;
}
return
strArr
;
}
function
validateProtocolFail
(
name
,
msg
)
{
console
.
warn
(
`
${
name
}
:
${
msg
}
`
);
}
...
...
@@ -4498,6 +4510,40 @@ const GetLocationProtocol = {
type
:
String
,
altitude
:
Boolean
};
const
API_CHOOSE_FILE
=
"
chooseFile
"
;
const
CHOOSE_MEDIA_TYPE
=
[
"
all
"
,
"
image
"
,
"
video
"
];
const
ChooseFileOptions
=
{
formatArgs
:
{
count
(
count
,
params
)
{
if
(
!
count
||
count
<=
0
)
{
params
.
count
=
100
;
}
},
sourceType
(
sourceType
,
params
)
{
params
.
sourceType
=
elemsInArray
(
sourceType
,
CHOOSE_SOURCE_TYPES
);
},
type
(
type
,
params
)
{
params
.
type
=
elemInArray
(
type
,
CHOOSE_MEDIA_TYPE
);
},
extension
(
extension
,
params
)
{
if
(
extension
instanceof
Array
&&
extension
.
length
===
0
)
{
return
"
param extension should not be empty.
"
;
}
if
(
!
extension
)
params
.
extension
=
[
""
];
}
}
};
const
ChooseFileProtocol
=
{
count
:
Number
,
sourceType
:
Array
,
type
:
String
,
extension
:
Array
};
const
API_GET_IMAGE_INFO
=
"
getImageInfo
"
;
const
GetImageInfoOptions
=
{
formatArgs
:
{
...
...
@@ -4771,6 +4817,9 @@ function createRouteOptions(type) {
}
function
createNormalizeUrl
(
type
)
{
return
function
normalizeUrl
(
url
,
params
)
{
if
(
!
url
)
{
return
`Missing required args: "url"`
;
}
url
=
getRealRoute
(
url
);
const
pagePath
=
url
.
split
(
"
?
"
)[
0
];
if
(
url
===
"
/
"
)
{
...
...
@@ -10447,6 +10496,10 @@ const getSystemInfoSync = defineSyncApi("getSystemInfoSync", () => {
break
;
}
}
}
else
if
(
isIPadOS
)
{
model
=
"
iPad
"
;
osname
=
"
iOS
"
;
osversion
=
typeof
window
.
BigInt
===
"
function
"
?
"
14.0
"
:
"
13.0
"
;
}
else
if
(
isWindows
||
isMac
||
isLinux
)
{
model
=
"
PC
"
;
osname
=
"
PC
"
;
...
...
@@ -10734,6 +10787,142 @@ const getImageInfo = defineAsyncApi(API_GET_IMAGE_INFO, ({src}, {resolve, reject
};
img
.
src
=
src
;
},
GetImageInfoProtocol
,
GetImageInfoOptions
);
const
MIMEType
=
{
image
:
{
jpg
:
"
jpeg
"
,
jpe
:
"
jpeg
"
,
pbm
:
"
x-portable-bitmap
"
,
pgm
:
"
x-portable-graymap
"
,
pnm
:
"
x-portable-anymap
"
,
ppm
:
"
x-portable-pixmap
"
,
psd
:
"
vnd.adobe.photoshop
"
,
pic
:
"
x-pict
"
,
rgb
:
"
x-rgb
"
,
svg
:
"
svg+xml
"
,
svgz
:
"
svg+xml
"
,
tif
:
"
tiff
"
,
xif
:
"
vnd.xiff
"
,
wbmp
:
"
vnd.wap.wbmp
"
,
wdp
:
"
vnd.ms-photo
"
,
xbm
:
"
x-xbitmap
"
,
ico
:
"
x-icon
"
},
video
:
{
"
3g2
"
:
"
3gpp2
"
,
"
3gp
"
:
"
3gpp
"
,
avi
:
"
x-msvideo
"
,
f4v
:
"
x-f4v
"
,
flv
:
"
x-flv
"
,
jpgm
:
"
jpm
"
,
jpgv
:
"
jpeg
"
,
m1v
:
"
mpeg
"
,
m2v
:
"
mpeg
"
,
mpe
:
"
mpeg
"
,
mpg
:
"
mpeg
"
,
mpg4
:
"
mpeg
"
,
m4v
:
"
x-m4v
"
,
mkv
:
"
x-matroska
"
,
mov
:
"
quicktime
"
,
qt
:
"
quicktime
"
,
movie
:
"
x-sgi-movie
"
,
mp4v
:
"
mp4
"
,
ogv
:
"
ogg
"
,
smv
:
"
x-smv
"
,
wm
:
"
x-ms-wm
"
,
wmv
:
"
x-ms-wmv
"
,
wmx
:
"
x-ms-wmx
"
,
wvx
:
"
x-ms-wvx
"
}
};
const
ALL
=
"
all
"
;
function
isWXEnv
()
{
const
ua2
=
window
.
navigator
.
userAgent
.
toLowerCase
();
const
matchUA
=
ua2
.
match
(
/MicroMessenger/i
);
return
!!
(
matchUA
&&
matchUA
[
0
]
===
"
micromessenger
"
);
}
function
_createInput
({
count
,
sourceType
,
type
,
extension
})
{
const
inputEl
=
document
.
createElement
(
"
input
"
);
inputEl
.
type
=
"
file
"
;
updateElementStyle
(
inputEl
,
{
position
:
"
absolute
"
,
visibility
:
"
hidden
"
,
zIndex
:
"
-999
"
,
width
:
"
0
"
,
height
:
"
0
"
,
top
:
"
0
"
,
left
:
"
0
"
});
inputEl
.
accept
=
extension
.
map
((
item
)
=>
{
if
(
type
!==
ALL
)
{
const
MIMEKey
=
item
.
replace
(
"
.
"
,
""
);
return
`
${
type
}
/
${
MIMEType
[
type
][
MIMEKey
]
||
MIMEKey
}
`
;
}
else
{
if
(
isWXEnv
())
{
return
"
.
"
;
}
return
item
.
indexOf
(
"
.
"
)
===
0
?
item
:
`.
${
item
}
`
;
}
}).
join
(
"
,
"
);
if
(
count
&&
count
>
1
)
{
inputEl
.
multiple
=
true
;
}
if
(
type
!==
ALL
&&
sourceType
instanceof
Array
&&
sourceType
.
length
===
1
&&
sourceType
[
0
]
===
"
camera
"
)
{
inputEl
.
setAttribute
(
"
capture
"
,
"
camera
"
);
}
return
inputEl
;
}
let
fileInput
=
null
;
const
chooseFile
=
defineAsyncApi
(
API_CHOOSE_FILE
,
({
count
,
sourceType
,
type
,
extension
},
{
resolve
,
reject
})
=>
{
if
(
fileInput
)
{
document
.
body
.
removeChild
(
fileInput
);
fileInput
=
null
;
}
fileInput
=
_createInput
({
count
,
sourceType
,
type
,
extension
});
document
.
body
.
appendChild
(
fileInput
);
fileInput
.
addEventListener
(
"
change
"
,
function
(
event2
)
{
const
eventTarget
=
event2
.
target
;
const
tempFiles
=
[];
if
(
eventTarget
&&
eventTarget
.
files
)
{
const
fileCount
=
eventTarget
.
files
.
length
;
for
(
let
i2
=
0
;
i2
<
fileCount
;
i2
++
)
{
const
file
=
eventTarget
.
files
[
i2
];
let
filePath
;
Object
.
defineProperty
(
file
,
"
path
"
,
{
get
()
{
filePath
=
filePath
||
fileToUrl
(
file
);
return
filePath
;
}
});
if
(
i2
<
count
)
tempFiles
.
push
(
file
);
}
}
const
res
=
{
errMsg
:
"
chooseFile:ok
"
,
get
tempFilePaths
()
{
return
tempFiles
.
map
(({
path
})
=>
path
);
},
tempFiles
};
resolve
(
res
);
});
fileInput
.
click
();
},
ChooseFileProtocol
,
ChooseFileOptions
);
const
request
=
defineTaskApi
(
API_REQUEST
,
({
url
,
data
,
...
...
@@ -11348,7 +11537,10 @@ const redirectTo = defineAsyncApi(API_REDIRECT_TO, ({url}, {resolve, reject}) =>
removeCurrentPages
(
1
,
true
);
return
navigate
(
API_REDIRECT_TO
,
url
).
then
(
resolve
).
catch
(
reject
);
},
RedirectToProtocol
,
RedirectToOptions
);
const
reLaunch
=
defineAsyncApi
(
API_RE_LAUNCH
,
({
url
},
{
resolve
,
reject
})
=>
navigate
(
API_RE_LAUNCH
,
url
).
then
(
resolve
).
catch
(
reject
),
ReLaunchProtocol
,
ReLaunchOptions
);
const
reLaunch
=
defineAsyncApi
(
API_RE_LAUNCH
,
({
url
},
{
resolve
,
reject
})
=>
{
removeAllCurrentPages
();
return
navigate
(
API_RE_LAUNCH
,
url
).
then
(
resolve
).
catch
(
reject
);
},
ReLaunchProtocol
,
ReLaunchOptions
);
const
switchTab
=
defineAsyncApi
(
API_SWITCH_TAB
,
({
url
},
{
resolve
,
reject
})
=>
navigate
(
API_SWITCH_TAB
,
url
).
then
(
resolve
).
catch
(
reject
),
SwitchTabProtocol
,
SwitchTabOptions
);
function
setNavigationBar
(
pageMeta
,
type
,
args
,
resolve
,
reject
)
{
if
(
!
pageMeta
)
{
...
...
@@ -11540,6 +11732,7 @@ var api = /* @__PURE__ */ Object.freeze({
getFileInfo
,
openDocument
,
getImageInfo
,
chooseFile
,
request
,
downloadFile
,
uploadFile
,
...
...
@@ -12604,4 +12797,4 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
]);
}
_sfc_main
.
render
=
_sfc_render
;
export
{
_sfc_main$1
as
AsyncErrorComponent
,
_sfc_main
as
AsyncLoadingComponent
,
_sfc_main$n
as
Audio
,
index$4
as
Button
,
_sfc_main$m
as
Canvas
,
_sfc_main$l
as
Checkbox
,
_sfc_main$k
as
CheckboxGroup
,
_sfc_main$j
as
Editor
,
index$5
as
Form
,
index$3
as
Icon
,
_sfc_main$h
as
Image
,
_sfc_main$g
as
Input
,
_sfc_main$f
as
Label
,
LayoutComponent
,
_sfc_main$e
as
MovableView
,
_sfc_main$d
as
Navigator
,
index
as
PageComponent
,
_sfc_main$c
as
Progress
,
_sfc_main$b
as
Radio
,
_sfc_main$a
as
RadioGroup
,
_sfc_main$i
as
ResizeSensor
,
_sfc_main$9
as
RichText
,
_sfc_main$8
as
ScrollView
,
_sfc_main$7
as
Slider
,
_sfc_main$6
as
SwiperItem
,
_sfc_main$5
as
Switch
,
index$2
as
Text
,
_sfc_main$4
as
Textarea
,
UniServiceJSBridge$1
as
UniServiceJSBridge
,
UniViewJSBridge$1
as
UniViewJSBridge
,
_sfc_main$3
as
Video
,
index$1
as
View
,
addInterceptor
,
arrayBufferToBase64
,
base64ToArrayBuffer
,
canIUse
,
closeSocket
,
connectSocket
,
createIntersectionObserver
,
createSelectorQuery
,
createVideoContext
,
cssBackdropFilter
,
cssConstant
,
cssEnv
,
cssVar
,
downloadFile
,
getApp$1
as
getApp
,
getCurrentPages$1
as
getCurrentPages
,
getFileInfo
,
getImageInfo
,
getLocation
,
getNetworkType
,
getSystemInfo
,
getSystemInfoSync
,
hideLoading
,
hideNavigationBarLoading
,
hideTabBar
,
hideTabBarRedDot
,
hideToast
,
makePhoneCall
,
navigateBack
,
navigateTo
,
offAccelerometerChange
,
offNetworkStatusChange
,
onAccelerometerChange
,
onNetworkStatusChange
,
onSocketClose
,
onSocketError
,
onSocketMessage
,
onSocketOpen
,
onTabBarMidButtonTap
,
openDocument
,
index$6
as
plugin
,
promiseInterceptor
,
reLaunch
,
redirectTo
,
removeInterceptor
,
removeTabBarBadge
,
request
,
sendSocketMessage
,
setNavigationBarColor
,
setNavigationBarTitle
,
setTabBarBadge
,
setTabBarItem
,
setTabBarStyle
,
setupApp
,
setupPage
,
showActionSheet
,
showLoading
,
showModal
,
showNavigationBarLoading
,
showTabBar
,
showTabBarRedDot
,
showToast
,
startAccelerometer
,
stopAccelerometer
,
switchTab
,
uni$1
as
uni
,
uploadFile
,
upx2px
,
usePageRoute
,
useSubscribe
};
export
{
_sfc_main$1
as
AsyncErrorComponent
,
_sfc_main
as
AsyncLoadingComponent
,
_sfc_main$n
as
Audio
,
index$4
as
Button
,
_sfc_main$m
as
Canvas
,
_sfc_main$l
as
Checkbox
,
_sfc_main$k
as
CheckboxGroup
,
_sfc_main$j
as
Editor
,
index$5
as
Form
,
index$3
as
Icon
,
_sfc_main$h
as
Image
,
_sfc_main$g
as
Input
,
_sfc_main$f
as
Label
,
LayoutComponent
,
_sfc_main$e
as
MovableView
,
_sfc_main$d
as
Navigator
,
index
as
PageComponent
,
_sfc_main$c
as
Progress
,
_sfc_main$b
as
Radio
,
_sfc_main$a
as
RadioGroup
,
_sfc_main$i
as
ResizeSensor
,
_sfc_main$9
as
RichText
,
_sfc_main$8
as
ScrollView
,
_sfc_main$7
as
Slider
,
_sfc_main$6
as
SwiperItem
,
_sfc_main$5
as
Switch
,
index$2
as
Text
,
_sfc_main$4
as
Textarea
,
UniServiceJSBridge$1
as
UniServiceJSBridge
,
UniViewJSBridge$1
as
UniViewJSBridge
,
_sfc_main$3
as
Video
,
index$1
as
View
,
addInterceptor
,
arrayBufferToBase64
,
base64ToArrayBuffer
,
canIUse
,
c
hooseFile
,
c
loseSocket
,
connectSocket
,
createIntersectionObserver
,
createSelectorQuery
,
createVideoContext
,
cssBackdropFilter
,
cssConstant
,
cssEnv
,
cssVar
,
downloadFile
,
getApp$1
as
getApp
,
getCurrentPages$1
as
getCurrentPages
,
getFileInfo
,
getImageInfo
,
getLocation
,
getNetworkType
,
getSystemInfo
,
getSystemInfoSync
,
hideLoading
,
hideNavigationBarLoading
,
hideTabBar
,
hideTabBarRedDot
,
hideToast
,
makePhoneCall
,
navigateBack
,
navigateTo
,
offAccelerometerChange
,
offNetworkStatusChange
,
onAccelerometerChange
,
onNetworkStatusChange
,
onSocketClose
,
onSocketError
,
onSocketMessage
,
onSocketOpen
,
onTabBarMidButtonTap
,
openDocument
,
index$6
as
plugin
,
promiseInterceptor
,
reLaunch
,
redirectTo
,
removeInterceptor
,
removeTabBarBadge
,
request
,
sendSocketMessage
,
setNavigationBarColor
,
setNavigationBarTitle
,
setTabBarBadge
,
setTabBarItem
,
setTabBarStyle
,
setupApp
,
setupPage
,
showActionSheet
,
showLoading
,
showModal
,
showNavigationBarLoading
,
showTabBar
,
showTabBarRedDot
,
showToast
,
startAccelerometer
,
stopAccelerometer
,
switchTab
,
uni$1
as
uni
,
uploadFile
,
upx2px
,
usePageRoute
,
useSubscribe
};
packages/uni-h5/src/framework/plugin/app.ts
浏览文件 @
a86e108a
...
...
@@ -6,11 +6,6 @@ export function getApp() {
return
appVm
}
export
function
isApp
(
vm
:
ComponentPublicInstance
)
{
// @dcloudio/vite-plugin-uni/src/configResolved/plugins/mainJs.ts
return
vm
.
$options
.
mpType
===
'
app
'
}
export
function
initApp
(
vm
:
ComponentPublicInstance
)
{
appVm
=
vm
appVm
.
$vm
=
vm
...
...
packages/uni-h5/src/framework/plugin/page.ts
浏览文件 @
a86e108a
...
...
@@ -28,6 +28,10 @@ export function getCurrentPages(isAll: boolean = false) {
return
[...
currentPagesMap
.
values
()]
}
export
function
removeAllCurrentPages
()
{
removeCurrentPages
(
getCurrentPages
(
true
).
length
,
true
)
}
export
function
removeCurrentPages
(
delta
:
number
=
1
,
removeRouteCaches
=
false
...
...
@@ -60,11 +64,6 @@ export function createPageState(type: NavigateType) {
}
}
export
function
isPage
(
vm
:
ComponentPublicInstance
)
{
// @dcloudio/vite-plugin-uni/src/configResolved/plugins/pageVue.ts
return
vm
.
$options
.
mpType
===
'
page
'
}
function
initPublicPage
(
route
:
RouteLocationNormalizedLoaded
)
{
if
(
!
route
)
{
const
{
path
}
=
__uniRoutes
[
0
]
...
...
packages/uni-h5/src/framework/plugin/provide/page.ts
浏览文件 @
a86e108a
...
...
@@ -81,11 +81,11 @@ function normalizePageMeta(pageMeta: UniApp.PageRouteMeta) {
navigationBar
.
titleColor
=
navigationBar
.
titleColor
||
'
#fff
'
navigationBar
.
backgroundColor
=
navigationBar
.
backgroundColor
||
'
#F7F7F7
'
if
(
__UNI_FEATURE_PAGES__
)
{
if
(
__UNI_FEATURE_PAGES__
&&
history
.
state
)
{
// 首页执行了redirectTo
const
type
=
history
.
state
.
__type__
if
(
history
.
state
&&
history
.
state
.
__type__
===
'
redirectTo
'
&&
(
type
===
'
redirectTo
'
||
type
===
'
reLaunch
'
)
&&
getCurrentPages
().
length
===
0
)
{
pageMeta
.
isEntry
=
true
...
...
packages/uni-h5/src/service/api/route/reLaunch.ts
浏览文件 @
a86e108a
...
...
@@ -5,12 +5,15 @@ import {
ReLaunchOptions
,
ReLaunchProtocol
,
}
from
'
@dcloudio/uni-api
'
import
{
removeAllCurrentPages
}
from
'
../../../framework/plugin/page
'
import
{
navigate
}
from
'
./utils
'
export
const
reLaunch
=
defineAsyncApi
<
API_TYPE_RE_LAUNCH
>
(
API_RE_LAUNCH
,
({
url
},
{
resolve
,
reject
})
=>
navigate
(
API_RE_LAUNCH
,
url
).
then
(
resolve
).
catch
(
reject
),
({
url
},
{
resolve
,
reject
})
=>
{
removeAllCurrentPages
()
return
navigate
(
API_RE_LAUNCH
,
url
).
then
(
resolve
).
catch
(
reject
)
},
ReLaunchProtocol
,
ReLaunchOptions
)
packages/uni-shared/dist/uni-shared.cjs.js
浏览文件 @
a86e108a
...
...
@@ -110,6 +110,11 @@ const invokeArrayFns = (fns, arg) => {
}
return
ret
;
};
function
updateElementStyle
(
element
,
styles
)
{
for
(
const
attrName
in
styles
)
{
element
.
style
[
attrName
]
=
styles
[
attrName
];
}
}
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
...
...
@@ -237,3 +242,4 @@ exports.passive = passive;
exports
.
plusReady
=
plusReady
;
exports
.
removeLeadingSlash
=
removeLeadingSlash
;
exports
.
stringifyQuery
=
stringifyQuery
;
exports
.
updateElementStyle
=
updateElementStyle
;
packages/uni-shared/dist/uni-shared.d.ts
浏览文件 @
a86e108a
...
...
@@ -66,4 +66,6 @@ export declare const TABBAR_HEIGHT = 50;
export
declare
const
TAGS
:
string
[];
export
declare
function
updateElementStyle
(
element
:
HTMLElement
,
styles
:
Partial
<
CSSStyleDeclaration
>
):
void
;
export
{
}
packages/uni-shared/dist/uni-shared.esm.js
浏览文件 @
a86e108a
...
...
@@ -106,6 +106,11 @@ const invokeArrayFns = (fns, arg) => {
}
return
ret
;
};
function
updateElementStyle
(
element
,
styles
)
{
for
(
const
attrName
in
styles
)
{
element
.
style
[
attrName
]
=
styles
[
attrName
];
}
}
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
...
...
@@ -209,4 +214,4 @@ const RESPONSIVE_MIN_WIDTH = 768;
const
COMPONENT_NAME_PREFIX
=
'
VUni
'
;
const
PRIMARY_COLOR
=
'
#007aff
'
;
export
{
BUILT_IN_TAGS
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
NAVBAR_HEIGHT
,
PLUS_RE
,
PRIMARY_COLOR
,
RESPONSIVE_MIN_WIDTH
,
TABBAR_HEIGHT
,
TAGS
,
debounce
,
decode
,
decodedQuery
,
getLen
,
invokeArrayFns
,
isBuiltInComponent
,
isCustomElement
,
isNativeTag
,
normalizeDataset
,
parseQuery
,
passive
,
plusReady
,
removeLeadingSlash
,
stringifyQuery
};
export
{
BUILT_IN_TAGS
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
NAVBAR_HEIGHT
,
PLUS_RE
,
PRIMARY_COLOR
,
RESPONSIVE_MIN_WIDTH
,
TABBAR_HEIGHT
,
TAGS
,
debounce
,
decode
,
decodedQuery
,
getLen
,
invokeArrayFns
,
isBuiltInComponent
,
isCustomElement
,
isNativeTag
,
normalizeDataset
,
parseQuery
,
passive
,
plusReady
,
removeLeadingSlash
,
stringifyQuery
,
updateElementStyle
};
yarn.lock
浏览文件 @
a86e108a
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录