Skip to content

react-viewer 图片查看插件

text
//https://www.npmjs.com/package/react-viewer#viewerimagesize

import Viewer from 'react-viewer';  ///图片查看插件

showInspectionSheet =(files,index) =>{
    let imageList = [];
    files.map((item)=>{
        imageList.push({src:item.file})
    });
    // console.log(imageList)
    this.setState({
        visible:true,
        imageList:imageList,
        activeIndex:index,
    })
};                  

<Viewer
    visible={visible}
    onClose={()=>{
        this.setState({
            visible:false
        })
    }}
    activeIndex={activeIndex}
    images={imageList}
/>

Contributors

作者:Long Mo
字数统计:60 字
阅读时长:1 分钟
Long Mo
文章作者:Long Mo
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Longmo Docs