Vue CKEditor
made with
Vuejs
简介及使用教程
Vue CKEditor是一个用于Vue.js的CKEditor富文本编辑器组件,是对CKeditor2的Vue封装。
安装
Npm
npm i vue-ckeditor2
Yarn
yarn add vue-ckeditor2
浏览器
<script src="https://cdn.ckeditor.com/4.10.0/standard/ckeditor.js"></script>
使用
<template>
<div>
<vue-ckeditor
v-model="content"
:config="config"
@blur="onBlur($event)"
@focus="onFocus($event)"
@contentDom="onContentDom($event)"
@dialogDefinition="onDialogDefinition($event)"
@fileUploadRequest="onFileUploadRequest($event)"
@fileUploadResponse="onFileUploadResponse($event)" />
</div>
</template>
<script>
import VueCkeditor from 'vue-ckeditor2';
export default {
components: { VueCkeditor },
data() {
return {
content: '',
config: {
toolbar: [
['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript']
],
height: 300
}
};
},
methods: {
onBlur(evt) {
console.log(evt);
},
onFocus(evt) {
console.log(evt);
},
onContentDom(evt) {
console.log(evt);
},
onDialogDefinition(evt) {
console.log(evt);
},
onFileUploadRequest(evt) {
console.log(evt);
},
onFileUploadResponse(evt) {
console.log(evt);
}
}
};
</script>
示例
作者
Dang Van Thanh
@dangvanthanh相关项目