javascript - 在vue中,如何多次调用ueditor?
大家讲道理
大家讲道理 2017-04-11 10:23:43
[JavaScript讨论组]

在webpack的模块化构建当中,使用vue开发

在组件内import了ueditor,第一次打开或刷新页面,ueditor是正常渲染的

ueditor渲染在一个弹窗当中,弹窗关闭后,ueditor被销毁,再次打开弹窗,则ueditor没有被渲染

由于是spa应用,许多时候没有被刷新,那么,怎么让ueditor多次渲染?而避免刷新呢?


import '../../static/ueditor/ueditor.config.js'
import '../../static/ueditor/ueditor.all.js'
import '../../static/ueditor/lang/zh-cn/zh-cn.js'

// 在mounted中执行

UE.getEditor('content', {
          UEDITOR_HOME_URL: __dirname + 'static/ueditor/',
          serverUrl: config.ajaxUrl + '/ueditor/jsp/controller.jsp',
          autoHeight: false,
          initialFrameHeight: '250',
          emotionLocalization: true,
          scaleEnabled: true,
          toolbars: [[
            'fullscreen','undo', 'redo','emotion','bold', 'italic', 'underline','forecolor', 'backcolor','insertimage','blockquote','justifyleft', 'justifycenter', 'justifyright','inserttable'
          ]]
        });

模板:

very much Thanks in advance.

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

全部回复(1)
大家讲道理

离开时销毁editor对象

  data: () => (
    {
      editor: null,
    }
  ),
  mounted() {
    this.editor = UE.getEditor('editor');
  },
  destroyed() {
    this.editor.destroy();
  },
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号