vue中使用ckeditor富文本编辑器
1.public文件夹的.index.html文件
<script src="https://cdn.ckeditor.com/ckeditor5/35.4.0/super-build/ckeditor.js"></script>
<script src="https://cdn.ckeditor.com/ckeditor5/35.4.0/classic/translations/zh-cn.js"></script>
2.vue文件使用
<el-input id="editor" name="content" type="textarea" :rows="2" placeholder="请输入内容" v-model="content">
</el-input>
<script>
export default {
data() {
return {
content:''
}
},
methods: {
initCKEditor() {
CKEDITOR.ClassicEditor.create(document.getElementById("editor"), {
toolbar: {
items: [
'exportPDF', 'exportWord', '|',
'findAndReplace', 'selectAll', '|',
'heading', '|',
'bold', 'italic', 'strikethrough', 'underline', 'code', 'subscript', 'superscript', 'removeFormat', '|',
'bulletedList', 'numberedList', 'todoList', '|',
'outdent', 'indent', '|',
'undo', 'redo'