diff --git a/modules/web/.eslintrc-auto-import.json b/modules/web/.eslintrc-auto-import.json index fcb0d053c..58475c155 100644 --- a/modules/web/.eslintrc-auto-import.json +++ b/modules/web/.eslintrc-auto-import.json @@ -78,6 +78,7 @@ "watch": true, "watchEffect": true, "watchPostEffect": true, - "watchSyncEffect": true + "watchSyncEffect": true, + "toValue": true } -} \ No newline at end of file +} diff --git a/modules/web/scripts/sync.js b/modules/web/scripts/sync.js index ef9eb9039..2e47c8947 100644 --- a/modules/web/scripts/sync.js +++ b/modules/web/scripts/sync.js @@ -3,7 +3,7 @@ import fs from "node:fs"; const LEGADO_ASSETS_WEB_VUE_DIR = new URL( "../../../app/src/main/assets/web/vue", - import.meta.url + import.meta.url, ); const VUE_DIST_DIR = new URL("../dist", import.meta.url); @@ -33,8 +33,8 @@ fs.rm( throw error; } console.log("> cp success"); - } + }, ); }); - } + }, ); diff --git a/modules/web/src/api/index.js b/modules/web/src/api/index.js index e69ad4721..aeb9f1838 100644 --- a/modules/web/src/api/index.js +++ b/modules/web/src/api/index.js @@ -30,7 +30,7 @@ const saveBookProgressWithBeacon = (bookProgress) => { // 常规请求可能会被取消 使用Fetch keep-alive 或者 navigator.sendBeacon navigator.sendBeacon( `${import.meta.env.VITE_API || location.origin}/saveBookProgress`, - JSON.stringify(bookProgress) + JSON.stringify(bookProgress), ); }; @@ -41,19 +41,19 @@ const getChapterList = (/** @type {string} */ bookUrl) => const getBookContent = ( /** @type {string} */ bookUrl, - /** @type {number} */ chapterIndex + /** @type {number} */ chapterIndex, ) => ajax.get( "/getBookContent?url=" + encodeURIComponent(bookUrl) + "&index=" + - chapterIndex + chapterIndex, ); const search = ( /** @type {string} */ searchKey, /** @type {(data: string) => void} */ onReceive, - /** @type {() => void} */ onFinish + /** @type {() => void} */ onFinish, ) => { // webSocket const url = `ws://${hostname}:${Number(port) + 1}/searchBook`; @@ -97,7 +97,7 @@ const debug = ( /** @type {string} */ sourceUrl, /** @type {string} */ searchKey, /** @type {(data: string) => void} */ onReceive, - /** @type {() => void} */ onFinish + /** @type {() => void} */ onFinish, ) => { // webSocket const url = `ws://${hostname}:${Number(port) + 1}/${ diff --git a/modules/web/src/auto-imports.d.ts b/modules/web/src/auto-imports.d.ts index d11a4a101..5a17c2776 100644 --- a/modules/web/src/auto-imports.d.ts +++ b/modules/web/src/auto-imports.d.ts @@ -61,6 +61,7 @@ declare global { const toRaw: typeof import('vue')['toRaw'] const toRef: typeof import('vue')['toRef'] const toRefs: typeof import('vue')['toRefs'] + const toValue: typeof import('vue')['toValue'] const triggerRef: typeof import('vue')['triggerRef'] const unref: typeof import('vue')['unref'] const useAttrs: typeof import('vue')['useAttrs'] diff --git a/modules/web/src/components/BookItems.vue b/modules/web/src/components/BookItems.vue index 749e98338..7204c76c1 100644 --- a/modules/web/src/components/BookItems.vue +++ b/modules/web/src/components/BookItems.vue @@ -62,7 +62,7 @@ const getCover = (coverUrl) => { }; const subJustify = computed(() => - props.isSearch ? "space-between" : "flex-start" + props.isSearch ? "space-between" : "flex-start", ); diff --git a/modules/web/src/components/ChapterContent.vue b/modules/web/src/components/ChapterContent.vue index 9c0a2c440..e463878b6 100644 --- a/modules/web/src/components/ChapterContent.vue +++ b/modules/web/src/components/ChapterContent.vue @@ -59,7 +59,7 @@ const paragraphRef = ref(); const scrollToReadedLength = (length) => { if (length === 0) return; let paragraphIndex = chapterPos.value.findIndex( - (wordCount) => wordCount >= length + (wordCount) => wordCount >= length, ); if (paragraphIndex === -1) return; nextTick(() => { @@ -81,14 +81,14 @@ onMounted(() => { emit( "readedLengthChange", props.chapterIndex, - parseInt(target.dataset.chapterpos) + parseInt(target.dataset.chapterpos), ); } } }, { rootMargin: `0px 0px -${window.innerHeight - 24}px 0px`, - } + }, ); intersectionObserver.observe(titleRef.value); paragraphRef.value.forEach((element) => { @@ -105,8 +105,12 @@ onUnmounted(() => {