Skip to content

Commit 9fac378

Browse files
committed
fix: settings sync
1 parent 88c4221 commit 9fac378

File tree

5 files changed

+22
-19
lines changed

5 files changed

+22
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@
5959
"opencollective-postinstall": "^2.0.2",
6060
"vue-svg-icon-loader": "^2.1.1",
6161
"vue-template-compiler": "^2.6.10",
62-
"webpack-theme-color-replacer": "^1.2.17"
62+
"webpack-theme-color-replacer": "^1.3.12"
6363
}
6464
}

src/components/GlobalHeader/RightContent.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default {
4343
wrpCls () {
4444
return {
4545
'ant-pro-global-header-index-right': true,
46-
[`ant-pro-global-header-index-${(this.topMenu && this.isMobile) && this.theme || 'light'}`]: true
46+
[`ant-pro-global-header-index-${(this.isMobile || !this.topMenu) ? 'light' : this.theme}`]: true
4747
}
4848
}
4949
},

src/config/defaultSettings.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@ export default {
1717
navTheme: 'dark', // theme for nav menu
1818
primaryColor: '#52C41A', // primary color of ant design
1919
layout: 'sidemenu', // nav menu position: `sidemenu` or `topmenu`
20-
contentWidth: 'Fixed', // layout of content: `Fluid` or `Fixed`, only works when layout is topmenu
20+
contentWidth: 'Fluid', // layout of content: `Fluid` or `Fixed`, only works when layout is topmenu
2121
fixedHeader: false, // sticky header
22-
autoHideHeader: false, // auto hide header
2322
fixSiderbar: false, // sticky siderbar
2423
colorWeak: false,
2524
menu: {
2625
locale: true
2726
},
2827
title: 'Ant Design Pro',
29-
multiTab: false,
3028
pwa: false,
3129
iconfontUrl: '',
3230
production: process.env.NODE_ENV === 'production' && process.env.VUE_APP_PREVIEW !== 'true'

src/layouts/BasicLayout.vue

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<pro-layout
3-
title="Ant Design Pro"
3+
:title="title"
44
:menus="menus"
55
:collapsed="collapsed"
66
:mediaQuery="query"
@@ -13,7 +13,7 @@
1313
>
1414
<setting-drawer :settings="settings" @change="handleSettingChange" />
1515
<template v-slot:rightContentRender>
16-
<right-content :top-menu="settings.layout === 'topmenu'" :theme="settings.theme" />
16+
<right-content :top-menu="settings.layout === 'topmenu'" :is-mobile="isMobile" :theme="settings.theme" />
1717
</template>
1818
<template v-slot:footerRender>
1919
<global-footer />
@@ -23,11 +23,12 @@
2323
</template>
2424

2525
<script>
26-
import { SettingDrawer } from '@ant-design-vue/pro-layout'
26+
import { SettingDrawer, updateTheme } from '@ant-design-vue/pro-layout'
2727
import { i18nRender } from '@/locales'
2828
import { mapState } from 'vuex'
2929
import { SIDEBAR_TYPE, TOGGLE_MOBILE_TYPE } from '@/store/mutation-types'
3030
31+
import defaultSettings from '@/config/defaultSettings'
3132
import RightContent from '@/components/GlobalHeader/RightContent'
3233
import GlobalFooter from '@/components/GlobalFooter'
3334
import LogoSvg from '../assets/logo.svg?inline'
@@ -45,18 +46,19 @@ export default {
4546
menus: [],
4647
// 侧栏收起状态
4748
collapsed: false,
49+
title: defaultSettings.title,
4850
settings: {
4951
// 布局类型
50-
layout: 'sidemenu', // 'sidemenu', 'topmenu'
52+
layout: defaultSettings.layout, // 'sidemenu', 'topmenu'
5153
// 定宽: true / 流式: false
52-
contentWidth: false,
54+
contentWidth: defaultSettings.layout === 'sidemenu' ? false : defaultSettings.contentWidth === 'Fixed',
5355
// 主题 'dark' | 'light'
54-
theme: 'dark',
56+
theme: defaultSettings.navTheme,
5557
// 主色调
56-
primaryColor: '#1890ff',
57-
fixedHeader: false,
58-
fixSiderbar: false,
59-
colorWeak: false,
58+
primaryColor: defaultSettings.primaryColor,
59+
fixedHeader: defaultSettings.fixedHeader,
60+
fixSiderbar: defaultSettings.fixSiderbar,
61+
colorWeak: defaultSettings.colorWeak,
6062
6163
hideHintAlert: false,
6264
hideCopyButton: false
@@ -95,6 +97,9 @@ export default {
9597
}, 16)
9698
})
9799
}
100+
101+
// first update color
102+
updateTheme(this.settings.primaryColor)
98103
},
99104
methods: {
100105
i18nRender,

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11174,10 +11174,10 @@ webpack-sources@*, webpack-sources@^1.1.0, webpack-sources@^1.4.0, webpack-sourc
1117411174
source-list-map "^2.0.0"
1117511175
source-map "~0.6.1"
1117611176

11177-
webpack-theme-color-replacer@^1.2.17:
11178-
version "1.3.10"
11179-
resolved "https://registry.npm.taobao.org/webpack-theme-color-replacer/download/webpack-theme-color-replacer-1.3.10.tgz#2d61336ae4ba288cf8704457cdf8568525b10fca"
11180-
integrity sha1-LWEzauS6KIz4cERXzfhWhSWxD8o=
11177+
webpack-theme-color-replacer@^1.3.12:
11178+
version "1.3.12"
11179+
resolved "https://registry.npm.taobao.org/webpack-theme-color-replacer/download/webpack-theme-color-replacer-1.3.12.tgz#0593a3149310c0e5b6b85afeccd61925b1b8e86b"
11180+
integrity sha1-BZOjFJMQwOW2uFr+zNYZJbG46Gs=
1118111181
dependencies:
1118211182
webpack-sources "*"
1118311183

0 commit comments

Comments
 (0)