Micro letter applet rich-text rich text picture does not show, beyond the width

background:

    Local applets do micro-channel project exercises related to rich-text encountered the following problem.

problem:

  1. Product details page rich text editor pictures can not show? 

       solve:

<rich-text nodes="{{content}}"></rich-text>

   ps: content in picture must address is the network address, do background processing, the following

 $info['content'] = str_replace('/Uploads',"http://www.***.cn/Uploads",$info['content']);
2. 以上图可展示,但是图片宽度超出容器?

     Solution: you can choose one of two methods

     Method a: img interface for tagging (PHP)

$info['content'] = str_replace("<img ", "<img style='max-width:100%;height:auto;'", $info['content']);

   Method two: micro-channel js applet tag file to img

 that.setData({
          content: res.data.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto"')
        })


 that.setData({
          content: res.data.contents.replace('<img ', '<img style="max-width:100%;height:auto"')
        })

It can be.

Guess you like

Origin blog.csdn.net/qq_37301074/article/details/91412099