leaf-document-web/src/views/documents/View.vue

45 lines
994 B
Vue
Raw Normal View History

2023-12-07 13:24:42 +00:00
<script setup>
2023-12-07 13:28:17 +00:00
import router from "@/router";
import { ref } from "vue";
import { document } from "@/plugins/api";
import { MdPreview } from "md-editor-v3";
import LoadingComponent from "@/components/Loading.vue";
2023-12-07 14:17:00 +00:00
import getTheme from "@/plugins/getTheme";
2023-12-07 13:24:42 +00:00
2023-12-07 13:28:17 +00:00
const libraryId = parseInt(router.currentRoute.value.params.LibraryId);
const documentId = parseInt(router.currentRoute.value.params.DocumentId);
const loading = ref(true);
2023-12-07 13:24:42 +00:00
const docu = ref({
2023-12-07 13:28:17 +00:00
Title: "",
Content: "",
});
document
.libraryLibraryIdDocumentDocumentIdGet(libraryId, documentId)
.then((r) => {
docu.value = r.data;
console.log(r.data);
})
.finally(() => {
loading.value = false;
});
2023-12-07 13:24:42 +00:00
</script>
<template>
2023-12-07 13:28:17 +00:00
<div>
2023-12-07 13:24:42 +00:00
<v-btn @click="router.back(0)">返回</v-btn>
2023-12-07 13:28:17 +00:00
<div v-if="loading">
<LoadingComponent> </LoadingComponent>
</div>
<div v-else>
<h2>{{ docu.Title }}</h2>
2023-12-07 13:24:42 +00:00
2023-12-07 14:17:00 +00:00
<MdPreview :theme="getTheme" :modelValue="docu.Content" />
2023-12-07 13:28:17 +00:00
</div>
</div>
</template>