收藏
回答

rich-text 基础组件库3.4.7渲染异常,有人看看吗?

[渲染层错误] [Component] <rich-text>: parse error TypeError: Cannot read property 'replace' of null(env: Windows,mp,1.06.2402040; lib: 3.4.7)

// UNIAPP CODE :

<rich-text :nodes="nodes"></rich-text>

export default {
  data() {
    return {
      nodes:null
    }
  }
}

onLoad() {
this.nodes= [{"name":"p","attrs":{"style":"margin:5px 5px;font-size:15px;line-height:1.75;letter-spacing:0.2em;word-spacing:0.1em"},"children":[{"type":"text","text":"排序算法:"}]},{"name":"p","attrs":{"style":"margin:5px 5px;font-size:15px;line-height:1.75;letter-spacing:0.2em;word-spacing:0.1em"},"children":[{"type":"text","text":"``"}]}]
setTimeout(()=>{
  this.nodes = [{"name":"p","attrs":{"style":"margin:5px 5px;font-size:15px;line-height:1.75;letter-spacing:0.2em;word-spacing:0.1em"},"type":"node","children":[{"type":"text","text":"排序算法:"}]},{"name":"div","attrs":{"class":"hl-pre","style":"border-radius:5px;white-space:pre;background:#2d2d2d;font-size:12px;position:relative;user-select:none","data-content":"\n"},"type":"node","children":[{"name":"code","attrs":{"class":"hl-code","style":"display:block;overflow: auto;"},"type":"node","children":[{"name":"div","attrs":{"class":"markdown-wrap"},"type":"node","children":[{"name":"div","attrs":{"class":"hljs","style":"border-radius:5px;white-space:pre;background:#2d2d2d;font-size:12px;position:relative;padding:10px 8px 0;margin-bottom:5px;overflow:auto;display:block"},"type":"node","children":[{"name":"code","attrs":{},"type":"node","children":[{"name":"ol","attrs":{"style":"margin:5px 5px;font-size:15px;padding:0px 30px"},"type":"node","children":[{"type":"text","text":"text   "}]}]}]}]}]},{"name":"div","attrs":{"class":"hl-language","style":"user-select:none;position:absolute;top:3px;right:3px;font-size:10px;"},"children":[{"type":"text","text":"text   "}]},{"name":"div","attrs":{"class":"hl-copy","style":"user-select:none;position:absolute;top:0;right:3px;font-size:10px;"}}]}]
},1000)

}
回答关注问题邀请回答
收藏

3 个回答

登录 后发表内容