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

先将图片转成本地 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}}调用即可

posted @ 2017-12-05 11:41  houdzaiw  阅读(1413)  评论(0编辑  收藏  举报