From 8e17db012e45ab459cec3a0d3a1d5c7c47056dfe Mon Sep 17 00:00:00 2001 From: zyronon Date: Sat, 14 Oct 2023 01:24:05 +0800 Subject: [PATCH] save --- .gitignore | 1 + .../Article/EditBatchArticleModal.vue | 37 ++++++++++++------- src/components/List.vue | 17 ++++++++- src/hooks/translate.ts | 32 ++++++++-------- 4 files changed, 55 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index a547bf36..c92aeda5 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ dist-ssr *.njsproj *.sln *.sw? +report.html \ No newline at end of file diff --git a/src/components/Article/EditBatchArticleModal.vue b/src/components/Article/EditBatchArticleModal.vue index 34d098c3..16d2a13c 100644 --- a/src/components/Article/EditBatchArticleModal.vue +++ b/src/components/Article/EditBatchArticleModal.vue @@ -16,7 +16,6 @@ import {useDisableEventListener} from "@/hooks/event.ts"; import {MessageBox} from "@/utils/MessageBox.tsx"; import {useRuntimeStore} from "@/stores/runtime.ts"; - const base = useBaseStore() const runtimeStore = useRuntimeStore() @@ -24,6 +23,7 @@ let article = $ref
(cloneDeep(DefaultArticle)) let show = $ref(false) let showImportBtn = $ref(true) let editArticleRef: any = $ref() +let listEl: any = $ref() onMounted(() => { emitter.on(EventKey.openArticleListModal, (val: Article) => { @@ -212,6 +212,9 @@ function saveArticle(val: Article): boolean { } val.id = uuidv4() runtimeStore.editDict.articles.push(val) + setTimeout(()=>{ + listEl.scrollBottom() + }) } article = cloneDeep(val) //TODO 保存完成后滚动到对应位置 @@ -225,17 +228,6 @@ function saveAndNext(val: Article) { } } -const list = $computed(() => { - if (!article.id) { - return runtimeStore.editDict.articles.concat([article]) - } - return runtimeStore.editDict.articles -}) - -function getTitle(item: Article, index: number,) { - if (!item.id) return 'New article' - return `${index + 1}. ${item.title}` -}