fix(功能用例): 脑图-修复附件里图片不显示预览按钮的缺陷

This commit is contained in:
teukkk 2024-07-12 10:56:44 +08:00 committed by 刘瑞斌
parent 9dded07e77
commit 0f07d05953
1 changed files with 3 additions and 4 deletions

View File

@ -30,7 +30,7 @@
<!-- 本地文件 --> <!-- 本地文件 -->
<div v-if="item.local || item.status === 'init'" class="flex flex-nowrap"> <div v-if="item.local || item.status === 'init'" class="flex flex-nowrap">
<MsButton <MsButton
v-if="item.status !== 'init' && item.file.type.includes('image/')" v-if="item.file.type.includes('/image')"
type="button" type="button"
status="primary" status="primary"
class="!mr-[4px]" class="!mr-[4px]"
@ -225,9 +225,7 @@
// //
async function handlePreview(item: MsFileItem) { async function handlePreview(item: MsFileItem) {
try { try {
imageUrl.value = ''; if (item.status !== 'init') {
previewVisible.value = true;
if (!item.local) {
const res = await previewFile({ const res = await previewFile({
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
caseId: props.activeCase.id, caseId: props.activeCase.id,
@ -239,6 +237,7 @@
} else { } else {
imageUrl.value = item.url || ''; imageUrl.value = item.url || '';
} }
previewVisible.value = true;
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);