From 271aa770b1daf6edae2b1dd8804d34746a0fd3d0 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Tue, 9 May 2023 08:50:00 +0800 Subject: [PATCH] [skip ci] web: remove unnecessary watchers --- modules/web/src/components/ChapterContent.vue | 1 + modules/web/src/views/BookChapter.vue | 25 +++---------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/modules/web/src/components/ChapterContent.vue b/modules/web/src/components/ChapterContent.vue index cca741a08..c3115fd97 100644 --- a/modules/web/src/components/ChapterContent.vue +++ b/modules/web/src/components/ChapterContent.vue @@ -66,6 +66,7 @@ const paragraphSpacing = computed(() => props.spacing.paragraph); //段距 font: 24px / 32px PingFangSC-Regular, HelveticaNeue-Light, "Helvetica Neue Light", "Microsoft YaHei", sans-serif; } + p { display: block; word-wrap: break-word; diff --git a/modules/web/src/views/BookChapter.vue b/modules/web/src/views/BookChapter.vue index 4c55366d4..a6a32a001 100644 --- a/modules/web/src/views/BookChapter.vue +++ b/modules/web/src/views/BookChapter.vue @@ -166,18 +166,18 @@ const popupWidth = computed(() => { }); const bodyTheme = computed(() => { return { - background: settings.themes[theme.value].body, + background: bodyColor.value, }; }); const chapterTheme = computed(() => { return { - background: settings.themes[theme.value].content, + background: chapterColor.value, width: readWidth.value, }; }); const leftBarTheme = computed(() => { return { - background: settings.themes[theme.value].popup, + background: popupColor.value, marginLeft: miniInterface.value ? 0 : -(store.config.readWidth / 2 + 68) + "px", @@ -186,7 +186,7 @@ const leftBarTheme = computed(() => { }); const rightBarTheme = computed(() => { return { - background: settings.themes[theme.value].popup, + background: popupColor.value, marginRight: miniInterface.value ? 0 : -(store.config.readWidth / 2 + 52) + "px", @@ -197,23 +197,6 @@ const isNight = ref(false); watchEffect(() => { isNight.value = theme.value == 6; }); -watch(bodyColor, (color) => { - bodyTheme.value.background = color; -}); -watch(chapterColor, (color) => { - chapterTheme.value.background = color; -}); -watch(readWidth, (width) => { - chapterTheme.value.width = width; - let leftToolMargin = -((parseInt(width) + 130) / 2 + 68) + "px"; - let rightToolMargin = -((parseInt(width) + 130) / 2 + 52) + "px"; - leftBarTheme.value.marginLeft = leftToolMargin; - rightBarTheme.value.marginRight = rightToolMargin; -}); -watch(popupColor, (color) => { - leftBarTheme.value.background = color; - rightBarTheme.value.background = color; -}); watchEffect(() => { if (chapterData.value.length > 0) {