增加 Loading
This commit is contained in:
parent
3f8b8e3762
commit
9a8f75d6d0
@ -1,35 +1,42 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
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";
|
||||||
|
|
||||||
import router from '@/router';
|
const libraryId = parseInt(router.currentRoute.value.params.LibraryId);
|
||||||
import { ref } from 'vue'
|
const documentId = parseInt(router.currentRoute.value.params.DocumentId);
|
||||||
import { document } from '@/plugins/api';
|
const loading = ref(true);
|
||||||
import { MdPreview } from 'md-editor-v3';
|
|
||||||
|
|
||||||
|
|
||||||
const libraryId = parseInt(router.currentRoute.value.params.LibraryId)
|
|
||||||
const documentId = parseInt(router.currentRoute.value.params.DocumentId)
|
|
||||||
|
|
||||||
const docu = ref({
|
const docu = ref({
|
||||||
Title: "",
|
Title: "",
|
||||||
Content: ""
|
Content: "",
|
||||||
})
|
});
|
||||||
|
|
||||||
document.libraryLibraryIdDocumentDocumentIdGet(libraryId, documentId).then((r) => {
|
|
||||||
docu.value = r.data
|
|
||||||
|
|
||||||
console.log(r.data)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
document
|
||||||
|
.libraryLibraryIdDocumentDocumentIdGet(libraryId, documentId)
|
||||||
|
.then((r) => {
|
||||||
|
docu.value = r.data;
|
||||||
|
|
||||||
|
console.log(r.data);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<div>
|
||||||
<v-btn @click="router.back(0)">返回</v-btn>
|
<v-btn @click="router.back(0)">返回</v-btn>
|
||||||
|
|
||||||
<h2>{{ docu.Title }}</h2>
|
<div v-if="loading">
|
||||||
|
<LoadingComponent> </LoadingComponent>
|
||||||
<MdPreview :modelValue="docu.Content" />
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<h2>{{ docu.Title }}</h2>
|
||||||
|
|
||||||
|
<MdPreview :modelValue="docu.Content" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
Loading…
Reference in New Issue
Block a user