网上查了很多方式都不是很好用,最后想到了这样的处理方式

首先在js中定义一个全局变量

var ue = null;

然后在初始化显示编辑器的时候js这样写 

if (ue == null) {
ue = new baidu.editor.ui.Editor();
ue.render('email_template');
}
ue.setContent("11111");

这样就可以第一次的时候正常显示编辑器的值

--初始化赋值 避免js报错

var ue = UE.getEditor('txtContent', {
toolbars: [
['bold', 'italic', 'underline', 'fontborder', 'justifyleft', 'justifycenter',
'justifyright', 'justifyjustify']
]
});
ue.addListener("ready", function () {
// editor准备好之后才可以使用
ue.setContent('abc');
});

相关文章:

  • 2022-12-23
  • 2021-08-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-29
  • 2021-09-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-13
  • 2021-09-09
  • 2021-11-14
  • 2022-12-23
  • 2021-07-04
相关资源
相似解决方案