From 654cfe6a2efdef074f4303a299b2479e15c8977e Mon Sep 17 00:00:00 2001 From: ivamp Date: Thu, 7 Dec 2023 23:15:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/documents/List.vue | 9 +++++++++ src/views/documents/View.vue | 23 +++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/views/documents/List.vue b/src/views/documents/List.vue index c18f17d..8a44a63 100644 --- a/src/views/documents/List.vue +++ b/src/views/documents/List.vue @@ -86,6 +86,15 @@ function load() { .libraryLibraryIdDocumentsGet(page.value, libraryId) .then((r) => { documents.value = r.data; + + + console.log(page.value) + if (page.value == 1) { + if (r.data.Data.length == 1) { + goto_document(r.data.Data[0].ID); + } + } + }) .finally(() => { loading.value = false; diff --git a/src/views/documents/View.vue b/src/views/documents/View.vue index 420eb00..4b4ce24 100644 --- a/src/views/documents/View.vue +++ b/src/views/documents/View.vue @@ -6,7 +6,6 @@ import { MdPreview } from "md-editor-v3"; import LoadingComponent from "@/components/Loading.vue"; import getTheme from "@/plugins/getTheme"; - const libraryId = parseInt(router.currentRoute.value.params.LibraryId); const documentId = parseInt(router.currentRoute.value.params.DocumentId); const loading = ref(true); @@ -26,14 +25,34 @@ document .finally(() => { loading.value = false; }); + +function goto_create_document() { + router.push({ + name: "library.documents.create", + params: { + LibraryId: libraryId, + }, + }); +} + +function goto_query_library() { + router.push({ + name: "library.query", + params: { + LibraryId: libraryId, + }, + }); +}