From 9f84fbfc02567e73536cb23ace99e550ba5557d3 Mon Sep 17 00:00:00 2001 From: Benny Guo Date: Sun, 10 Sep 2023 14:41:10 +0800 Subject: [PATCH] fix: header width is not updated after resize of the browser window --- src/components/Sticky.vue | 4 ++-- src/pages/post/[slug].vue | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/components/Sticky.vue b/src/components/Sticky.vue index 36622f34..ea5e0ca1 100644 --- a/src/components/Sticky.vue +++ b/src/components/Sticky.vue @@ -96,14 +96,14 @@ export default defineComponent({ this.height = this.$el.getBoundingClientRect().height this.updateScroll() document.addEventListener('scroll', this.handleScroll) - document.addEventListener('resize', this.handleResize) + window.addEventListener('resize', this.handleResize) }, activated() { this.updateScroll() }, unmounted() { document.removeEventListener('scroll', this.handleScroll) - document.removeEventListener('resize', this.handleResize) + window.removeEventListener('resize', this.handleResize) }, methods: { sticky(top: number, position: any) { diff --git a/src/pages/post/[slug].vue b/src/pages/post/[slug].vue index f6d474cd..e3a993eb 100644 --- a/src/pages/post/[slug].vue +++ b/src/pages/post/[slug].vue @@ -241,15 +241,11 @@ export default defineComponent({ }) if (appStore.hexoConfig.writing.highlight.enable) { // eslint-disable-next-line no-console - console.error( - '[Aurora Config Error]: Please turn off [Hightlightjs] and enable [Prismjs] instead. ' - ) + console.warn('[Aurora Config Error]: Please turn off [Hightlightjs].') } - if (appStore.hexoConfig.writing.prismjs.preprocess) { + if (appStore.hexoConfig.writing.prismjs.enable) { // eslint-disable-next-line no-console - console.error( - "[Aurora Config Error]: Please set Hexo config's prismjs' [preprocess] property to false! " - ) + console.warn('[Aurora Config Error]: Please turn off [prismjs]. ') } await nextTick() initializeLightBox()