WebView加载大图image时候显示不全

时间:2017-12-05 12:58:06   收藏:0   阅读:348

先将图片转成本地 html,

const imgHtml = `<html>
<body style="width: 100%; height: 100%">
<img style="width: 100%; height: auto; margin: auto" src="${src}" onclick="window.postMessage(‘click‘)">//注:src是传入的图片src
</body>
</html>`;

使用

const imgHtml = this.getImgHtml(this.state.imageUrl);来获取本地的html,注:this.state.imageUrl是传入的图片URI

在使用source={{html: imgHtml}}调用即可

原文:http://www.cnblogs.com/houdzaiw/p/7986108.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!