chore: loading
This commit is contained in:
parent
c978d14ea2
commit
75b766eeba
@ -22,11 +22,22 @@ defineOptions({
|
|||||||
const props = defineProps<{ task?: TaskInfo }>();
|
const props = defineProps<{ task?: TaskInfo }>();
|
||||||
|
|
||||||
const currentFlowInfo = ref<FlowInfoResponse>();
|
const currentFlowInfo = ref<FlowInfoResponse>();
|
||||||
|
/**
|
||||||
|
* card的loading状态
|
||||||
|
*/
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
async function handleLoadInfo(task: TaskInfo | undefined) {
|
async function handleLoadInfo(task: TaskInfo | undefined) {
|
||||||
if (!task) return null;
|
try {
|
||||||
const resp = await flowInfo(task.businessId);
|
if (!task) return null;
|
||||||
currentFlowInfo.value = resp;
|
loading.value = true;
|
||||||
|
const resp = await flowInfo(task.businessId);
|
||||||
|
currentFlowInfo.value = resp;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(() => props.task, handleLoadInfo);
|
watch(() => props.task, handleLoadInfo);
|
||||||
@ -38,6 +49,7 @@ onUnmounted(() => (currentFlowInfo.value = undefined));
|
|||||||
<Card
|
<Card
|
||||||
v-if="task"
|
v-if="task"
|
||||||
:body-style="{ overflowY: 'auto', height: '100%' }"
|
:body-style="{ overflowY: 'auto', height: '100%' }"
|
||||||
|
:loading="loading"
|
||||||
:title="`编号: ${task.id}`"
|
:title="`编号: ${task.id}`"
|
||||||
class="thin-scrollbar flex-1 overflow-y-hidden"
|
class="thin-scrollbar flex-1 overflow-y-hidden"
|
||||||
size="small"
|
size="small"
|
||||||
|
Loading…
Reference in New Issue
Block a user