perf: 优化任务详情右键预览图片

This commit is contained in:
kuaifan 2022-04-25 07:58:17 +08:00
parent 5d1d108811
commit c748d8f5f6

View File

@ -303,7 +303,12 @@
$A.messageWarning("没有可预览的图片")
return;
}
this.$store.state.previewImageIndex = 0;
let index = 0;
const imgElm = editor.selection.getNode();
if (imgElm && imgElm.nodeName === "IMG") {
index = array.findIndex(item => item === imgElm.getAttribute("src"));
}
this.$store.state.previewImageIndex = index;
this.$store.state.previewImageList = array;
}
});