feat: add configuration of hiding page title in PageLayout; #106

新增:增加隐藏 PageLayout 布局中页面标题的配置;
This commit is contained in:
chenghongxing 2020-08-25 19:22:08 +08:00
parent de925b254e
commit 9f034092a9
3 changed files with 8 additions and 8 deletions

View File

@ -11,7 +11,7 @@
<div class="detail"> <div class="detail">
<div class="main"> <div class="main">
<div class="row"> <div class="row">
<h1 v-if="title" class="title">{{title}}</h1> <h1 v-if="showPageTitle && title" class="title">{{title}}</h1>
<div class="action"><slot name="action"></slot></div> <div class="action"><slot name="action"></slot></div>
</div> </div>
<div class="row"> <div class="row">
@ -28,11 +28,12 @@
</template> </template>
<script> <script>
import {mapState} from 'vuex'
export default { export default {
name: 'PageHeader', name: 'PageHeader',
props: { props: {
title: { title: {
type: String, type: [String, Boolean],
required: false required: false
}, },
breadcrumb: { breadcrumb: {
@ -49,9 +50,7 @@ export default {
}, },
}, },
computed: { computed: {
layout () { ...mapState('setting', ['layout', 'showPageTitle'])
return this.$store.state.setting.layout
}
} }
} }
</script> </script>

View File

@ -15,8 +15,9 @@ module.exports = {
multiPage: false, //多页签模式true:开启false:不开启 multiPage: false, //多页签模式true:开启false:不开启
hideSetting: false, //隐藏设置抽屉true:隐藏false:不隐藏 hideSetting: false, //隐藏设置抽屉true:隐藏false:不隐藏
systemName: 'Vue Antd Admin', //系统名称 systemName: 'Vue Antd Admin', //系统名称
copyright: '2018 ICZER 工作室出品', //copyright copyright: '2018 ICZER 工作室出品', //copyright
asyncRoutes: false, //异步加载路由true:开启false:不开启 asyncRoutes: false, //异步加载路由true:开启false:不开启
showPageTitle: true, //是否显示页面标题PageLayout 布局中的页面标题true:显示false:不显示
animate: { //动画设置 animate: { //动画设置
disabled: false, //禁用动画true:禁用false:启用 disabled: false, //禁用动画true:禁用false:启用
name: 'bounce', //动画效果,支持的动画效果可参考 ./animate.config.js name: 'bounce', //动画效果,支持的动画效果可参考 ./animate.config.js

View File

@ -63,7 +63,7 @@ export default {
...mapState('setting', ['layout', 'multiPage', 'pageMinHeight']), ...mapState('setting', ['layout', 'multiPage', 'pageMinHeight']),
pageTitle() { pageTitle() {
let pageTitle = this.page && this.page.title let pageTitle = this.page && this.page.title
return this.title || this.$t(pageTitle) || this.routeName return pageTitle === undefined ? (this.title || this.routeName) : this.$t(pageTitle)
}, },
routeName() { routeName() {
const route = this.$route const route = this.$route