提交 8525739c 编写于 作者: X xzs02

Merge branch 'dev' of github.com:dcloudio/uni-app into dev

......@@ -61,12 +61,26 @@ function beforeEach (to, from, next, routes) {
case 'redirectTo':
// 关闭前一个页面
removeKeepAliveInclude.call(this, fromName)
if (from.meta) {
if (from.meta.isQuit) { // 如果 redirectTo 的前一个页面是 quit 类型,则新打开的页面也是 quit
to.meta.isQuit = true
to.meta.isEntry = !!from.meta.isEntry
}
if (from.meta.isTabBar) { // 如果是 tabBar,需要更新系统组件 tabBar 内的 list 数据
to.meta.isTabBar = true
to.meta.tabBarIndex = from.meta.tabBarIndex
const appVm = getApp().$children[0]
appVm.$set(appVm.tabBar.list[to.meta.tabBarIndex], 'pagePath', to.meta.pagePath)
}
}
break
case 'switchTab':
switchTab.call(this, routes)
break
case 'reLaunch':
reLaunch.call(this, toName)
to.meta.isQuit = true // reLaunch后,该页面为 quit 类型
break
default:
// 后退或非 API 访问
......
......@@ -20,7 +20,8 @@ export function pageScrollTo ({
scrollTop = Math.min(scrollTop, scrollHeight - clientHeight)
if (duration === 0) {
documentElement.scrollTop = scrollTop
// 部分浏览器(比如微信)中 scrollTop 的值需要通过 document.body 来控制
documentElement.scrollTop = document.body.scrollTop = scrollTop
return
}
......
......@@ -22,11 +22,11 @@
</uni-page>
</template>
<style>
uni-page {
display: block;
width: 100%;
height: 100%;
}
uni-page {
display: block;
width: 100%;
height: 100%;
}
</style>
<script>
import {
......@@ -137,7 +137,7 @@ export default {
data () {
const navigationBar = mergeTitleNView({
loading: false,
backButton: !this.isQuit,
backButton: !this.isQuit && !this.$route.meta.isQuit, // redirectTo,reLaunch时可能动态修改 meta.isQuit
backgroundColor: this.navigationBarBackgroundColor,
textColor: this.navigationBarTextStyle === 'black' ? '#000' : '#fff',
titleText: this.navigationBarTitleText,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册