feat: v1.12.3

This commit is contained in:
xugaoyi 2022-06-03 20:42:34 +08:00
parent a6ea991a29
commit bc6cc128e2
6 changed files with 19 additions and 8 deletions

View File

@ -155,6 +155,9 @@ export default defineConfig4CustomTheme<VdoingThemeConfig>({
// sidebarOpen: false, // 初始状态是否打开左侧边栏默认true // sidebarOpen: false, // 初始状态是否打开左侧边栏默认true
// pageButton: false, // 是否显示快捷翻页按钮默认true // pageButton: false, // 是否显示快捷翻页按钮默认true
// 默认外观模式(用户未在页面手动修改过模式时才生效,否则以用户设置的模式为准),可选:'auto' | 'light' | 'dark' | 'read',默认'auto'。
// defaultMode: 'auto',
// 侧边栏 'structuring' | { mode: 'structuring', collapsable: Boolean} | 'auto' | <自定义> 温馨提示:目录页数据依赖于结构化的侧边栏数据,如果你不设置为'structuring',将无法使用目录页 // 侧边栏 'structuring' | { mode: 'structuring', collapsable: Boolean} | 'auto' | <自定义> 温馨提示:目录页数据依赖于结构化的侧边栏数据,如果你不设置为'structuring',将无法使用目录页
sidebar: 'structuring', sidebar: 'structuring',

View File

@ -24,7 +24,7 @@
"vuepress-plugin-one-click-copy": "^1.0.2", "vuepress-plugin-one-click-copy": "^1.0.2",
"vuepress-plugin-thirdparty-search": "^1.0.2", "vuepress-plugin-thirdparty-search": "^1.0.2",
"vuepress-plugin-zooming": "^1.1.7", "vuepress-plugin-zooming": "^1.1.7",
"vuepress-theme-vdoing": "^1.12.1", "vuepress-theme-vdoing": "^1.12.3",
"yamljs": "^0.3.0" "yamljs": "^0.3.0"
} }
} }

View File

@ -56,7 +56,7 @@ export default {
scrollTop: null, scrollTop: null,
showCommentBut: false, showCommentBut: false,
commentTop: null, commentTop: null,
currentMode: null, currentMode: '',
showModeBox: false, showModeBox: false,
modeList: [ modeList: [
{ {
@ -89,8 +89,7 @@ export default {
} }
}, },
mounted () { mounted () {
this.currentMode = storage.get('mode') || 'auto' this.currentMode = storage.get('mode') || this.$themeConfig.defaultMode ||'auto'
this.scrollTop = this.getScrollTop() this.scrollTop = this.getScrollTop()
window.addEventListener('scroll', debounce(() => { window.addEventListener('scroll', debounce(() => {
this.scrollTop = this.getScrollTop() this.scrollTop = this.getScrollTop()

View File

@ -121,7 +121,7 @@ export default {
hideNavbar: false, hideNavbar: false,
isSidebarOpen: true, isSidebarOpen: true,
showSidebar: false, showSidebar: false,
themeMode: 'light', themeMode: 'auto',
showWindowLB: true, showWindowLB: true,
showWindowRB: true showWindowRB: true
} }
@ -203,7 +203,6 @@ export default {
'have-body-img': this.$themeConfig.bodyBgImg, 'have-body-img': this.$themeConfig.bodyBgImg,
'only-sidebarItem': this.sidebarItems.length === 1 && this.sidebarItems[0].type === 'page', // 'only-sidebarItem': this.sidebarItems.length === 1 && this.sidebarItems[0].type === 'page', //
}, },
// 'theme-mode-' + this.themeMode,
userPageClass userPageClass
] ]
} }
@ -217,7 +216,11 @@ export default {
beforeMount() { beforeMount() {
this.isSidebarOpenOfclientWidth() this.isSidebarOpenOfclientWidth()
const mode = storage.get('mode') // createdvuepresscreated访apiwindow const mode = storage.get('mode') // createdvuepresscreated访apiwindow
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() this._autoMode()
} else { } else {
this.themeMode = mode this.themeMode = mode

View File

@ -1,6 +1,6 @@
{ {
"name": "vuepress-theme-vdoing", "name": "vuepress-theme-vdoing",
"version": "1.12.1", "version": "1.12.3",
"description": "Vdoing theme for VuePress. 一个基于VuePress的知识管理兼博客主题。", "description": "Vdoing theme for VuePress. 一个基于VuePress的知识管理兼博客主题。",
"author": { "author": {
"name": "gaoyi(Evan) Xu" "name": "gaoyi(Evan) Xu"

View File

@ -101,6 +101,12 @@ export interface VdoingThemeConfig extends NoSidebar4DefaultThemeConfig {
*/ */
pageButton?: boolean; pageButton?: boolean;
/**
*
* @default 'auto'
*/
defaultMode?: 'auto' | 'light' | 'dark' | 'read';
/** /**
* *
*/ */