|
[多端开发]
rich-text 遇到复杂点的html代码就无法执行了
[复制链接]
与后端交互获得的html内容,只要富文本内容稍微的复杂一些,rich-text 就似乎无法解析了,表现为白屏
写法上面,除了内容是我复制了 与后台交互过来的内容外,其他的都是抄的官方文档里面的案例
经过测试,把P标签删除就可以了,但是实际商用了以后,后端传递过来的富文本内容都是由客户编辑的,并无法要求客户按那些格式来写
- <template>
- <scroll-view class="main" scroll-y>
- <rich-text nodes={nodes}></rich-text>
- </scroll-view>
- </template>
- <style>
- .main {
- width: 100%;
- height: 100%;
- }
- </style>
- <script>
- export default {
- name: 'test',
- data(){
- return {
- nodes: ''
- }
- },
- methods:{
- apiready(){
- this.data.nodes = `
- <p><img src="http://mgj-file**.**/admin/2/Goods/202010/5f9a87cada32c.jpg" title="202010/5f9a87cada32c.jpg" alt="u=1883517582,62032572&fm=26&gp=0.jpg"/></p><p><img src="http://mgj-file**.**/admin/2/Goods/202010/5f9a87e356a1f.jpg" title="202010/5f9a87e356a1f.jpg" alt="u=1457857732,1619988551&fm=26&gp=0.jpg"/></p><p><br/></p>;
- }
- }
- }
- </script>
复制代码
|
|