Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

直接上代码:

import Viewer from 'viewerjs';

previewImg =?() => {
     const viewer = new Viewer(document.getElementById('imglist'),{
        url: 'data-original'
     });
}

<ul className="img-list" id="imglist">
    {
         list.map(({src}, index) => (
             <li>
                 <img
                     src={src}
                     key={index}
                     onClick={this.previewImg}
                     data-original={src}
                 />
             </li>
         ))
    }
</ul>

这样操作,查看大图时没有弹出这个插件,但是在页面底部出现了一些东东,检查元素看起来就是预览大图时弹框的结构 但是定位有问题 也没看到有大图的img标签什么的
男到react中不能使用Viewerjs只能用基于这个封装的react-viewer?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
224 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...