增加 Loading
This commit is contained in:
parent
0649a582b7
commit
b485d27acf
22
src/components/Loading.vue
Normal file
22
src/components/Loading.vue
Normal file
@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<div
|
||||
class="d-flex text-center"
|
||||
style="
|
||||
width: 100%;
|
||||
height: 60%;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
"
|
||||
>
|
||||
<div>
|
||||
<div>
|
||||
<v-progress-circular
|
||||
indeterminate
|
||||
></v-progress-circular>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<p>请稍后...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
@ -1,5 +1,8 @@
|
||||
<template>
|
||||
<v-container v-if="libraries.Data">
|
||||
<LoadingComponent v-if="loading">
|
||||
|
||||
</LoadingComponent>
|
||||
<v-container v-else>
|
||||
<h1>资料库</h1>
|
||||
|
||||
{{ selected_ids }}
|
||||
@ -53,17 +56,22 @@
|
||||
|
||||
<script setup>
|
||||
import { library } from "@/plugins/api";
|
||||
import { watch } from "vue";
|
||||
import { ref } from "vue";
|
||||
import LoadingComponent from "@/components/Loading.vue";
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const page = ref(1);
|
||||
const libraries = ref({});
|
||||
|
||||
const load = () => {
|
||||
loading.value = true
|
||||
library.librariesGet(page.value).then((r) => {
|
||||
libraries.value = r.data;
|
||||
console.log(r.data.Data);
|
||||
});
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
|
||||
load();
|
||||
|
Loading…
Reference in New Issue
Block a user