feat(front): add ImageCompressResult component to ResultIndexView for handling image compression results

This commit is contained in:
keven1024
2025-05-28 10:38:10 +08:00
parent 247eb7a4c8
commit e2ccd93a7d

View File

@@ -19,21 +19,24 @@ const handleList = [
{ component: FileShareResult, key: 'file-share' },
{ component: TextShareResult, key: 'text-share' },
]
const handleComponent = computed(() => {
return handleList.find((item) => item.key === props?.data?.handle_type)?.component
const activeHandle = computed(() => {
return handleList.find((item) => item.key === props?.data?.handle_type)
})
// vue这个ts蠢的没边了本来想写component: FileShareResult | TextShareResult结果不行
</script>
<template>
<div>
<FileShareResult
v-if="handleComponent === FileShareResult && 'file' in data"
<component
v-if="'file' in data"
:is="activeHandle?.component"
:data="data"
@change="(key: string) => emit('change', key)"
/>
<TextShareResult
v-else-if="handleComponent === TextShareResult && 'text' in data"
<component
v-if="'text' in data"
:is="activeHandle?.component"
:data="data"
@change="(key: string) => emit('change', key)"
/>