Skip to content

Commit bc6cc12

Browse files
committed
feat: v1.12.3
1 parent a6ea991 commit bc6cc12

File tree

6 files changed

+19
-8
lines changed

6 files changed

+19
-8
lines changed

docs/.vuepress/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ export default defineConfig4CustomTheme<VdoingThemeConfig>({
155155
// sidebarOpen: false, // 初始状态是否打开左侧边栏,默认true
156156
// pageButton: false, // 是否显示快捷翻页按钮,默认true
157157

158+
// 默认外观模式(用户未在页面手动修改过模式时才生效,否则以用户设置的模式为准),可选:'auto' | 'light' | 'dark' | 'read',默认'auto'。
159+
// defaultMode: 'auto',
160+
158161
// 侧边栏 'structuring' | { mode: 'structuring', collapsable: Boolean} | 'auto' | <自定义> 温馨提示:目录页数据依赖于结构化的侧边栏数据,如果你不设置为'structuring',将无法使用目录页
159162
sidebar: 'structuring',
160163

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"vuepress-plugin-one-click-copy": "^1.0.2",
2525
"vuepress-plugin-thirdparty-search": "^1.0.2",
2626
"vuepress-plugin-zooming": "^1.1.7",
27-
"vuepress-theme-vdoing": "^1.12.1",
27+
"vuepress-theme-vdoing": "^1.12.3",
2828
"yamljs": "^0.3.0"
2929
}
3030
}

vdoing/components/Buttons.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default {
5656
scrollTop: null,
5757
showCommentBut: false,
5858
commentTop: null,
59-
currentMode: null,
59+
currentMode: '',
6060
showModeBox: false,
6161
modeList: [
6262
{
@@ -89,8 +89,7 @@ export default {
8989
}
9090
},
9191
mounted () {
92-
this.currentMode = storage.get('mode') || 'auto'
93-
92+
this.currentMode = storage.get('mode') || this.$themeConfig.defaultMode ||'auto'
9493
this.scrollTop = this.getScrollTop()
9594
window.addEventListener('scroll', debounce(() => {
9695
this.scrollTop = this.getScrollTop()

vdoing/layouts/Layout.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export default {
121121
hideNavbar: false,
122122
isSidebarOpen: true,
123123
showSidebar: false,
124-
themeMode: 'light',
124+
themeMode: 'auto',
125125
showWindowLB: true,
126126
showWindowRB: true
127127
}
@@ -203,7 +203,6 @@ export default {
203203
'have-body-img': this.$themeConfig.bodyBgImg,
204204
'only-sidebarItem': this.sidebarItems.length === 1 && this.sidebarItems[0].type === 'page', // 左侧边栏只有一项时
205205
},
206-
// 'theme-mode-' + this.themeMode,
207206
userPageClass
208207
]
209208
}
@@ -217,7 +216,11 @@ export default {
217216
beforeMount() {
218217
this.isSidebarOpenOfclientWidth()
219218
const mode = storage.get('mode') // 不放在created是因为vuepress不能在created访问浏览器api,如window
220-
if (!mode || mode === 'auto') { // 当未切换过模式,或模式处于'跟随系统'时
219+
const { defaultMode } = this.$themeConfig
220+
221+
if (defaultMode && defaultMode !== 'auto' && !mode ) {
222+
this.themeMode = defaultMode
223+
} else if(!mode || mode === 'auto' || defaultMode === 'auto') { // 当未切换过模式,或模式处于'跟随系统'时
221224
this._autoMode()
222225
} else {
223226
this.themeMode = mode

vdoing/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vuepress-theme-vdoing",
3-
"version": "1.12.1",
3+
"version": "1.12.3",
44
"description": "Vdoing theme for VuePress. 一个基于VuePress的知识管理兼博客主题。",
55
"author": {
66
"name": "gaoyi(Evan) Xu"

vdoing/types/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ export interface VdoingThemeConfig extends NoSidebar4DefaultThemeConfig {
101101
*/
102102
pageButton?: boolean;
103103

104+
/**
105+
* 默认外观模式
106+
* @default 'auto'
107+
*/
108+
defaultMode?: 'auto' | 'light' | 'dark' | 'read';
109+
104110
/**
105111
* 侧边栏配置
106112
*/

0 commit comments

Comments
 (0)