提交 79d75cf3 authored 作者: 蔡元龙's avatar 蔡元龙

图片上传组件修改

上级 851924f4
...@@ -86,20 +86,25 @@ export default class UploadCom extends React.Component { ...@@ -86,20 +86,25 @@ export default class UploadCom extends React.Component {
{(files || []).map((f) => { {(files || []).map((f) => {
if ((f.path && f.path.indexOf('.png') !== -1) || f.path.indexOf('.jpg') !== -1) { if ((f.path && f.path.indexOf('.png') !== -1) || f.path.indexOf('.jpg') !== -1) {
return ( return (
<li key={f.path} className={styles.preview_img} style={{ position: 'relative' }}> <li key={f.path} className={styles.preview_img}>
<img <div className={styles.preview_div}>
style={{ width: 100, height: 100 }} <img
className={styles.img} style={{ width: '100%', height: 100 }}
src={queryApiActionPath() + f.path} className={styles.img}
onClick={() => { src={queryApiActionPath() + f.path}
// window.open(queryApiActionPath() + f.path); />
this.setState({ <div
previewVisible: true, className={styles.mask}
previewImage: queryApiActionPath() + f.path, onClick={() => {
}); // window.open(queryApiActionPath() + f.path);
}} this.setState({
/> previewVisible: true,
<Icon type="eye" className={styles.icon_eye} style={{}} /> previewImage: queryApiActionPath() + f.path,
});
}}>
<Icon type="eye" className={styles.icon_eye} />
</div>
</div>
{!disabled && ( {!disabled && (
<Icon <Icon
style={{ marginLeft: 10 }} style={{ marginLeft: 10 }}
......
...@@ -239,18 +239,32 @@ ...@@ -239,18 +239,32 @@
} }
.preview_img { .preview_img {
position: relative; display: flex;
.img { align-items: center;
&:hover + .icon_eye { .preview_div {
display: block; position: relative;
width: 100px;
height: 100px;
&:hover {
.mask {
display: block;
}
}
.mask {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .5);
position: absolute;
top: 0;
left: 0;
display: none;
.icon_eye {
position: absolute;
top: 50%;
left: 50%;
color: #fff;
transform: translate(-50%, -50%);
}
} }
}
.icon_eye {
position: absolute;
top: 50%;
left: 50%;
color: #fff;
transform: translate(-50%, -50%);
display: none;
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论