简体   繁体   English

在 VueJS 中注册 CKEditor 5 时出错

[英]Error when registering CKEditor 5 in VueJS

Here's my code:这是我的代码:

import Vue from 'vue';
import CKEditor from '@ckeditor/ckeditor5-build-balloon-block';
Vue.use( CKEditor );

It follows the example from the CKEditor documentation here, https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/vuejs.html .它遵循此处 CKEditor 文档中的示例, https: //ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/vuejs.html。 The only difference is that the documentation is loading the @ckeditor/ckeditor5-vue build.唯一的区别是文档正在加载@ckeditor/ckeditor5-vue构建。

I am using the Laravel UI boilerplate, so that means NPM and Webpack.我使用的是 Laravel UI 样板,所以这意味着 NPM 和 Webpack。 The package builds fine, but when I try to run it I get the following error:该包构建良好,但是当我尝试运行它时,出现以下错误:

TypeError: class constructors must be invoked with 'new'

This was a careless error.这是一个粗心的错误。 The import for CKEditor should have been specific to VueJS, not to a particular editor build. CKEditor 的导入应该特定于 VueJS,而不是特定的编辑器构建。 Here is the correct line:这是正确的行:

import CKEditor from '@ckeditor/ckeditor5-vue';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM