Преглед изворни кода

[skip ci] web: remove unnecessary watchers

Xwite пре 3 година
родитељ
комит
af1b6807b4
2 измењених фајлова са 5 додато и 21 уклоњено
  1. 1 0
      modules/web/src/components/ChapterContent.vue
  2. 4 21
      modules/web/src/views/BookChapter.vue

+ 1 - 0
modules/web/src/components/ChapterContent.vue

@@ -66,6 +66,7 @@ const paragraphSpacing = computed(() => props.spacing.paragraph); //段距
   font: 24px / 32px PingFangSC-Regular, HelveticaNeue-Light,
   font: 24px / 32px PingFangSC-Regular, HelveticaNeue-Light,
     "Helvetica Neue Light", "Microsoft YaHei", sans-serif;
     "Helvetica Neue Light", "Microsoft YaHei", sans-serif;
 }
 }
+
 p {
 p {
   display: block;
   display: block;
   word-wrap: break-word;
   word-wrap: break-word;

+ 4 - 21
modules/web/src/views/BookChapter.vue

@@ -166,18 +166,18 @@ const popupWidth = computed(() => {
 });
 });
 const bodyTheme = computed(() => {
 const bodyTheme = computed(() => {
   return {
   return {
-    background: settings.themes[theme.value].body,
+    background: bodyColor.value,
   };
   };
 });
 });
 const chapterTheme = computed(() => {
 const chapterTheme = computed(() => {
   return {
   return {
-    background: settings.themes[theme.value].content,
+    background: chapterColor.value,
     width: readWidth.value,
     width: readWidth.value,
   };
   };
 });
 });
 const leftBarTheme = computed(() => {
 const leftBarTheme = computed(() => {
   return {
   return {
-    background: settings.themes[theme.value].popup,
+    background: popupColor.value,
     marginLeft: miniInterface.value
     marginLeft: miniInterface.value
       ? 0
       ? 0
       : -(store.config.readWidth / 2 + 68) + "px",
       : -(store.config.readWidth / 2 + 68) + "px",
@@ -186,7 +186,7 @@ const leftBarTheme = computed(() => {
 });
 });
 const rightBarTheme = computed(() => {
 const rightBarTheme = computed(() => {
   return {
   return {
-    background: settings.themes[theme.value].popup,
+    background: popupColor.value,
     marginRight: miniInterface.value
     marginRight: miniInterface.value
       ? 0
       ? 0
       : -(store.config.readWidth / 2 + 52) + "px",
       : -(store.config.readWidth / 2 + 52) + "px",
@@ -197,23 +197,6 @@ const isNight = ref(false);
 watchEffect(() => {
 watchEffect(() => {
   isNight.value = theme.value == 6;
   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(() => {
 watchEffect(() => {
   if (chapterData.value.length > 0) {
   if (chapterData.value.length > 0) {