Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
m0_68066342
uni-app
提交
af2da948
U
uni-app
项目概览
m0_68066342
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
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,发现更多精彩内容 >>
提交
af2da948
编写于
6月 27, 2019
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修复H5端部分情况document.title不自动更新的问题
上级
34856a1b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
33 addition
and
24 deletion
+33
-24
src/core/service/api/navigation-bar.js
src/core/service/api/navigation-bar.js
+4
-1
src/core/service/plugins/app/router-guard.js
src/core/service/plugins/app/router-guard.js
+7
-4
src/platforms/h5/components/page/index.vue
src/platforms/h5/components/page/index.vue
+16
-11
src/platforms/h5/components/page/pageHead.vue
src/platforms/h5/components/page/pageHead.vue
+1
-8
src/platforms/h5/components/system-routes/system-header.vue
src/platforms/h5/components/system-routes/system-header.vue
+5
-0
未找到文件。
src/core/service/api/navigation-bar.js
浏览文件 @
af2da948
...
...
@@ -34,6 +34,9 @@ function setNavigationBar (type, args) {
title
}
=
args
page
.
navigationBar
.
titleText
=
title
if
(
__PLATFORM__
===
'
h5
'
)
{
document
.
title
=
title
}
break
}
}
...
...
@@ -53,4 +56,4 @@ export function hideNavigationBarLoading () {
export
function
setNavigationBarTitle
(
args
)
{
return
setNavigationBar
(
'
setNavigationBarTitle
'
,
args
)
}
}
src/core/service/plugins/app/router-guard.js
浏览文件 @
af2da948
...
...
@@ -39,9 +39,9 @@ function saveTabBarScrollPosition (id) {
function
switchTab
(
routes
,
to
,
from
)
{
if
(
to
&&
from
&&
to
.
meta
.
isTabBar
&&
from
.
meta
.
isTabBar
from
&&
to
.
meta
.
isTabBar
&&
from
.
meta
.
isTabBar
)
{
// tabbar 跳 tabbar
saveTabBarScrollPosition
(
from
.
params
.
__id__
)
}
...
...
@@ -196,6 +196,9 @@ function afterEach (to, from) {
setTimeout
(
function
()
{
callPageHook
(
toVm
,
'
onShow
'
)
},
0
)
if
(
__PLATFORM__
===
'
h5
'
)
{
document
.
title
=
toVm
.
$parent
.
$parent
.
navigationBar
.
titleText
}
}
}
}
...
...
@@ -208,4 +211,4 @@ export default function initRouterGuard (appVm, routes) {
appVm
.
$router
.
afterEach
(
function
(
to
,
from
)
{
afterEach
.
call
(
appVm
,
to
,
from
)
})
}
}
src/platforms/h5/components/page/index.vue
浏览文件 @
af2da948
<
template
>
<uni-page
:data-page=
"$route.meta.pagePath"
>
<page-head
v-if=
"showNavigationBar"
<page-head
v-if=
"showNavigationBar"
v-bind=
"navigationBar"
/>
<page-refresh
v-if=
"enablePullDownRefresh"
ref=
"refresh"
:color=
"refreshOptions.color"
<page-refresh
v-if=
"enablePullDownRefresh"
ref=
"refresh"
:color=
"refreshOptions.color"
:offset=
"refreshOptions.offset"
/>
<page-body
v-if=
"enablePullDownRefresh"
@
touchstart.native=
"_touchstart"
<page-body
v-if=
"enablePullDownRefresh"
@
touchstart.native=
"_touchstart"
@
touchmove.native=
"_touchmove"
@
touchend.native=
"_touchend"
@
touchend.native=
"_touchend"
@
touchcancel.native=
"_touchend"
>
<slot
name=
"page"
/>
</page-body>
...
...
@@ -173,6 +173,11 @@ export default {
navigationBar
,
refreshOptions
}
},
created
()
{
if
(
__PLATFORM__
===
'
h5
'
)
{
document
.
title
=
this
.
navigationBar
.
titleText
}
}
}
</
script
>
</
script
>
src/platforms/h5/components/page/pageHead.vue
浏览文件 @
af2da948
...
...
@@ -382,15 +382,8 @@ export default {
}
return
btns
}
},
watch
:
{
titleText
(
newVal
,
oldVal
)
{
document
.
title
=
newVal
}
},
mounted
()
{
document
.
title
=
this
.
titleText
mounted
()
{
if
(
this
.
searchInput
)
{
const
input
=
this
.
$refs
.
input
input
.
$watch
(
'
composing
'
,
val
=>
{
...
...
src/platforms/h5/components/system-routes/system-header.vue
浏览文件 @
af2da948
...
...
@@ -31,6 +31,11 @@ export default {
default
:
false
}
},
created
()
{
if
(
__PLATFORM__
===
'
h5
'
)
{
document
.
title
=
this
.
$slots
.
default
[
0
].
text
}
},
methods
:
{
_back
()
{
this
.
$emit
(
'
back
'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录