The given range isn‘t in document.

刺骨的言语ヽ痛彻心扉 2022-11-07 13:15 111阅读 0赞

问题: WangEditor在vue中使用,样式都正常显示,但是功能不能点击,查看控制台js显示The given range isn’t in document,这是因为模板渲染导致的。

解决:

  1. mounted : function(){
  2. let E = window.wangEditor;
  3. let wang = new E('#div-editor');
  4. wang.config.uploadImgShowBase64 = true
  5. wang.config.menus = [
  6. 'italic',
  7. 'underline',
  8. 'strikeThrough',
  9. 'indent',
  10. 'justify',
  11. 'image',
  12. 'table',
  13. 'splitLine',
  14. 'undo',
  15. 'redo',
  16. ]
  17. wang.config.showLinkImg = false;
  18. wang.create()
  19. },

将初始化代码放入mounted

发表评论

表情:
评论列表 (有 0 条评论,111人围观)

还没有评论,来说两句吧...

相关阅读