【增加】增加 loading

This commit is contained in:
cherishsince 2024-06-18 14:35:42 +08:00
parent 8db7c7d92b
commit 05ba908a7f

View File

@ -22,6 +22,7 @@
import {ImageApi, ImageDetailVO, ImageMjActionVO, ImageMjButtonsVO} from '@/api/ai/image'; import {ImageApi, ImageDetailVO, ImageMjActionVO, ImageMjButtonsVO} from '@/api/ai/image';
import ImageDetailDrawer from './ImageDetailDrawer.vue' import ImageDetailDrawer from './ImageDetailDrawer.vue'
import ImageTaskCard from './ImageTaskCard.vue' import ImageTaskCard from './ImageTaskCard.vue'
import {ElLoading} from "element-plus";
const message = useMessage() // const message = useMessage() //
@ -30,6 +31,7 @@ const imageListInterval = ref<any>() // image 列表定时器,刷新列表
const isShowImageDetail = ref<boolean>(false) // task const isShowImageDetail = ref<boolean>(false) // task
const showImageDetailId = ref<number>(0) // task const showImageDetailId = ref<number>(0) // task
const imageTaskRef = ref<any>() // ref const imageTaskRef = ref<any>() // ref
const imageTaskLoadingInstance = ref<any>() // loading
const imageTaskLoading = ref<boolean>(false) // loading const imageTaskLoading = ref<boolean>(false) // loading
const pageNo = ref<number>(1) // page no const pageNo = ref<number>(1) // page no
const pageSize = ref<number>(20) // page size const pageSize = ref<number>(20) // page size
@ -50,10 +52,17 @@ const handlerDrawerOpen = async () => {
const getImageList = async () => { const getImageList = async () => {
imageTaskLoading.value = true imageTaskLoading.value = true
try { try {
imageTaskLoadingInstance.value = ElLoading.service({
target: imageTaskRef.value,
text: '加载中...'
})
const { list } = await ImageApi.getImageList({pageNo: pageNo.value, pageSize: pageSize.value}) const { list } = await ImageApi.getImageList({pageNo: pageNo.value, pageSize: pageSize.value})
imageList.value.push.apply(imageList.value, list) imageList.value.push.apply(imageList.value, list)
} finally { } finally {
imageTaskLoading.value = false if (imageTaskLoadingInstance.value) {
imageTaskLoadingInstance.value.close();
imageTaskLoadingInstance.value = null;
}
} }
} }