提交 3cebcc14 编写于 作者: fxy060608's avatar fxy060608

fix: h5端 reLaunch 及在首页或 tab 页面 redirectTo 时与其他端保持一致(返回箭头,tabBar)

上级 d524ea79
...@@ -61,12 +61,26 @@ function beforeEach (to, from, next, routes) { ...@@ -61,12 +61,26 @@ function beforeEach (to, from, next, routes) {
case 'redirectTo': case 'redirectTo':
// 关闭前一个页面 // 关闭前一个页面
removeKeepAliveInclude.call(this, fromName) 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 break
case 'switchTab': case 'switchTab':
switchTab.call(this, routes) switchTab.call(this, routes)
break break
case 'reLaunch': case 'reLaunch':
reLaunch.call(this, toName) reLaunch.call(this, toName)
to.meta.isQuit = true // reLaunch后,该页面为 quit 类型
break break
default: default:
// 后退或非 API 访问 // 后退或非 API 访问
......
...@@ -22,11 +22,11 @@ ...@@ -22,11 +22,11 @@
</uni-page> </uni-page>
</template> </template>
<style> <style>
uni-page { uni-page {
display: block; display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
</style> </style>
<script> <script>
import { import {
...@@ -137,7 +137,7 @@ export default { ...@@ -137,7 +137,7 @@ export default {
data () { data () {
const navigationBar = mergeTitleNView({ const navigationBar = mergeTitleNView({
loading: false, loading: false,
backButton: !this.isQuit, backButton: !this.isQuit && !this.$route.meta.isQuit, // redirectTo,reLaunch时可能动态修改 meta.isQuit
backgroundColor: this.navigationBarBackgroundColor, backgroundColor: this.navigationBarBackgroundColor,
textColor: this.navigationBarTextStyle === 'black' ? '#000' : '#fff', textColor: this.navigationBarTextStyle === 'black' ? '#000' : '#fff',
titleText: this.navigationBarTitleText, titleText: this.navigationBarTitleText,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册