Skip to content

Commit 0a3fdb8

Browse files
author
reco_luan
committed
feat: add mode config
1 parent 31ab99f commit 0a3fdb8

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

components/Mode/ModePicker.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ export default {
3131
3232
mounted () {
3333
const mode = localStorage.getItem('mode')
34-
this.currentMode = mode === null ? 'auto' : mode
35-
if (mode === 'dark') {
34+
const { mode: customizeMode } = this.$themeConfig
35+
this.currentMode = mode === null ? customizeMode === undefined ? 'auto' : customizeMode : mode
36+
if (customizeMode === null) {
37+
activateMode('light')
38+
} else if (mode === 'dark') {
3639
activateMode('dark')
3740
} else if (mode === 'light') {
3841
activateMode('light')

components/Navbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
'max-width': linksWrapMaxWidth + 'px'
2323
} : {}">
2424

25-
<Mode />
25+
<Mode v-show="$themeConfig.mode !== null" />
2626
<AlgoliaSearchBox
2727
v-if="isAlgoliaSearch"
2828
:options="algolia"/>

0 commit comments

Comments
 (0)