const editor = new E('#content');报错无效的节点选择器

来源:8-7 集成富文本插件wangeditor

sphygmus

2023-03-30

安装最新的wangeditor版本,在加入富文本之后报错
无效的节点选择器。
改回课程中的版本也不行,报错
Uncaught Error: i18next:TypeError: editor.i18next.init is not a function
百度之后安装
npm install i18next --save
也不行,又换回最新版本。在每次新增和编辑时重新获取content的ID

setTimeout(function(){
	editor.create();
	},100)

改成了

setTimeout(function (){
        if(editor == null){
          editor =  new E('#content');
        }else{
          editor.destroy();
          editor =  new E('#content');
        }
        editor.create();
      },100)

就可以了,不知道写的是否足够精减和准确

写回答

1回答

sphygmus

提问者

2023-03-30

然后下一节课的内容再次报错,改回老师的版本,又好了······真棒呀

0
0

Spring Boot+Vue3前后端分离,实战wiki知识库系统

一课掌握前后端最火框架,更有职场竞争力

2524 学习 · 1671 问题

查看课程