rich-text 中 <img src="本地图片路径"/> 图片标签使用本地图片,在IOS中显示不出来

代码如下:

<!--index.wxml-->

<view class="container">

<rich-text nodes="{{html}}" bindtap="tap"></rich-text>

<button bindtap="selectImg">选择图片</button>

</view>


//index.js

const app = getApp()


Page({

data: {

html: '<div class="div_class" style="line-height: 60px; color: red;">Hello&nbsp;World!</div>',

},

onLoad: function () {

},

selectImg(){

wx.chooseImage({

count: 1,

sizeType: ['original', 'compressed'],

sourceType: ['album', 'camera'],

success: (res) =>{

let tempFilePaths = res.tempFilePaths

wx.saveFile({

tempFilePath: tempFilePaths[0],

success: (res) => {

let savedFilePath = res.savedFilePath

let html = `<div class="div_class" style="line-height: 60px; color: red;"><img src="${savedFilePath}"/></div>`

console.log(html)

this.setData({

html: html

})

}

})

}

})

}

})


展开全部
收起
1回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
  • 回忆的沙漏

    17人对此回答表示赞同

    代码:wechatide://minicode/kBCXYomQ7w1h

    展开
    17
    1回复
    发布于 6年前

    评论(1)

    收起评论

    • Aubree 2019-02-14 11:16

      反馈已收到,感谢反馈

      回复
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部