Skip to content

Commit

Permalink
feat: v1.12.3
Browse files Browse the repository at this point in the history
  • Loading branch information
xugaoyi committed Jun 3, 2022
1 parent a6ea991 commit bc6cc12
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
3 changes: 3 additions & 0 deletions docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ export default defineConfig4CustomTheme<VdoingThemeConfig>({
// sidebarOpen: false, // 初始状态是否打开左侧边栏,默认true
// pageButton: false, // 是否显示快捷翻页按钮,默认true

// 默认外观模式(用户未在页面手动修改过模式时才生效,否则以用户设置的模式为准),可选:'auto' | 'light' | 'dark' | 'read',默认'auto'。
// defaultMode: 'auto',

// 侧边栏 'structuring' | { mode: 'structuring', collapsable: Boolean} | 'auto' | <自定义> 温馨提示:目录页数据依赖于结构化的侧边栏数据,如果你不设置为'structuring',将无法使用目录页
sidebar: 'structuring',

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"vuepress-plugin-one-click-copy": "^1.0.2",
"vuepress-plugin-thirdparty-search": "^1.0.2",
"vuepress-plugin-zooming": "^1.1.7",
"vuepress-theme-vdoing": "^1.12.1",
"vuepress-theme-vdoing": "^1.12.3",
"yamljs": "^0.3.0"
}
}
5 changes: 2 additions & 3 deletions vdoing/components/Buttons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default {
scrollTop: null,
showCommentBut: false,
commentTop: null,
currentMode: null,
currentMode: '',
showModeBox: false,
modeList: [
{
Expand Down Expand Up @@ -89,8 +89,7 @@ export default {
}
},
mounted () {
this.currentMode = storage.get('mode') || 'auto'
this.currentMode = storage.get('mode') || this.$themeConfig.defaultMode ||'auto'
this.scrollTop = this.getScrollTop()
window.addEventListener('scroll', debounce(() => {
this.scrollTop = this.getScrollTop()
Expand Down
9 changes: 6 additions & 3 deletions vdoing/layouts/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default {
hideNavbar: false,
isSidebarOpen: true,
showSidebar: false,
themeMode: 'light',
themeMode: 'auto',
showWindowLB: true,
showWindowRB: true
}
Expand Down Expand Up @@ -203,7 +203,6 @@ export default {
'have-body-img': this.$themeConfig.bodyBgImg,
'only-sidebarItem': this.sidebarItems.length === 1 && this.sidebarItems[0].type === 'page', // 左侧边栏只有一项时
},
// 'theme-mode-' + this.themeMode,
userPageClass
]
}
Expand All @@ -217,7 +216,11 @@ export default {
beforeMount() {
this.isSidebarOpenOfclientWidth()
const mode = storage.get('mode') // 不放在created是因为vuepress不能在created访问浏览器api,如window
if (!mode || mode === 'auto') { // 当未切换过模式,或模式处于'跟随系统'时
const { defaultMode } = this.$themeConfig
if (defaultMode && defaultMode !== 'auto' && !mode ) {
this.themeMode = defaultMode
} else if(!mode || mode === 'auto' || defaultMode === 'auto') { // 当未切换过模式,或模式处于'跟随系统'时
this._autoMode()
} else {
this.themeMode = mode
Expand Down
2 changes: 1 addition & 1 deletion vdoing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vuepress-theme-vdoing",
"version": "1.12.1",
"version": "1.12.3",
"description": "Vdoing theme for VuePress. 一个基于VuePress的知识管理兼博客主题。",
"author": {
"name": "gaoyi(Evan) Xu"
Expand Down
6 changes: 6 additions & 0 deletions vdoing/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ export interface VdoingThemeConfig extends NoSidebar4DefaultThemeConfig {
*/
pageButton?: boolean;

/**
* 默认外观模式
* @default 'auto'
*/
defaultMode?: 'auto' | 'light' | 'dark' | 'read';

/**
* 侧边栏配置
*/
Expand Down

1 comment on commit bc6cc12

@vercel
Copy link

@vercel vercel bot commented on bc6cc12 Jun 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.