This commit is contained in:
ivamp 2023-12-07 23:15:03 +08:00
parent b22c2bfe76
commit 654cfe6a2e
2 changed files with 30 additions and 2 deletions

View File

@ -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;

View File

@ -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,
},
});
}
</script>
<template>
<div>
<v-btn @click="router.back(0)">返回</v-btn>
<v-btn class="ml-2" @click="goto_create_document">新建文档</v-btn>
<v-btn class="ml-2" @click="goto_query_library">查询</v-btn>
<div v-if="loading">
<LoadingComponent> </LoadingComponent>
<LoadingComponent> </LoadingComponent>
</div>
<div v-else>
<h2>{{ docu.Title }}</h2>