提交 5758ba0c authored 作者: 钟是志's avatar 钟是志

优化代码

上级 fd8f5bff
......@@ -8,7 +8,12 @@ export const ImgViewer = props => {
if (props.images && Array.isArray(props.images)) {
return props.images.filter(i => checkIsImage(i.src));
} else {
return [path];
return [
{
src: path,
alt: '预览',
},
];
}
}, [props.images]);
const activeIndex = useMemo(() => {
......@@ -17,9 +22,5 @@ export const ImgViewer = props => {
}
return 0;
}, [path]);
return <Viewer visible={true}
onClose={onClose}
activeIndex={activeIndex}
images={images}
/>;
return <Viewer visible={true} onClose={onClose} activeIndex={activeIndex} images={images} />;
};
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论