.m-t-10{margin-top:10px;}介绍在vue中创建多个ueditor实例。我用的是neditor,其实是美化了ueditor的风格。其他的和ueditor差不多。截图源地址https://github.com/Obliviouss...使用说明下载ueditor或neditor源码,复制到static目录下,然后修改ueditor.config.js配置文件。在vue项目的main.js中添加ueditor引用,新建3个页面home、tab1、tab2。Tab1和tab2是home下的子页面。keep-alive组件和transition组件必须添加在router-view之外。否则,ueditor实例无法保存在components文件夹下。新建一个编辑器作为编辑器的公共组件,在tab1中调用编辑器。同时,还要传入一个id,在编辑器页面接受。注意,如果需要多个实例,则id不能相同。当前富文本编辑器的内容为:{{content}}
.m-t-10{margin-top:10px;}editor页面代码,因为我们keep-alive是在router-view中应用的,所以ueditor的初始化必须放在activated中,保证每次进入页面surface会重新渲染ueditor,在deactivated调用ueditor的destroy方法,保证每次离开页面都会销毁editor实例,这样可以渲染多个ueditor实例,同时保存editor的内容每次切换如果多个tab只需要一个实例,请调用reset()方法