码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2017-12-05 13:33:56      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:source   mes   uri   font   idt   body   src   span   const   

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

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

标签:source   mes   uri   font   idt   body   src   span   const   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!