hinesboy / mavonEditor

mavonEditor - A markdown editor based on Vue that supports a variety of personalized features
http://www.mavoneditor.com/
MIT License
6.38k stars 916 forks source link

[Bug] 每次渲染mavon-editor组件都会给document多新增一个空的div标签 #785

Open huangrijian opened 2 years ago

huangrijian commented 2 years ago

每次渲染mavon-editor组件都会给document多新增一个空的div标签

版本:"mavon-editor": "^2.10.4",

我使用一个信息数组去循环遍历每一条信息数据项,利用mavon-editor组件对信息数据项进行加载, 但是发现每渲染一个mavon-editor组件都会给body新增一个空的div 导致我每次刷新页面都要渲染与信息数组长度相对应的空的div

这非常的耗费性能,并且我也不明白这些空的div有任何作用

<el-timeline-item :timestamp="item.create_time" placement="top" :key="index" v-for="(item,index) in AllArticle">
  <el-card>
    <span class="title">{{item.title}}</span>
    <mavon-editor v-model="item.content" defaultOpen="preview" :toolbarsFlag="false" :subfield="false" :codeStyle="codeStyle" :boxShadow="false" :ishljs="true" :externalLink="external_link">
    </mavon-editor>
    <p v-if="item.create_time">黄先森 {{item.create_time}}</p>
  </el-card>
</el-timeline-item>

Snipaste_2022-03-23_01-04-44

huangrijian commented 2 years ago

考虑到我的项目本身可能存在其他的bug,后来又创建一个新的vue项目,再次使用mavon-editor组件,这一次不使用v-for而是直接写死的,但是发现还是相同的问题


<div id="editor">
    <mavon-editor style="height: 100%"></mavon-editor>
    <mavon-editor style="height: 100%"></mavon-editor>
    <mavon-editor style="height: 100%"></mavon-editor>
    <mavon-editor style="height: 100%"></mavon-editor>
  </div>

Snipaste_2022-03-23_01-25-50