引入.js核心文件:
<script src="/static/vendor/ckeditor/ckeditor.js"></script>
页面定义textarea文本标签:
<textarea name="texteditor" placeholder="请认真填写真实有效的建议或反馈信息,内容不得少于50字" :maxlength="2500"></textarea>
初始化Ckeditor:
initCkeditor () {
// 标签name:texteditor
window.CKEDITOR.replace('texteditor', {
// 插入图片中预览图片框的文字
image_previewText: ' ',
// 设置高度
height: 100,
// 工具栏中的显示情况
toolbar: [
['Format'],
['Bold', 'Italic']
],
// 引入插件
extraPlugins: 'confighelper',
placeholder: ''
}).on('instanceReady', function (e) {
window.CKEDITOR.instances.texteditor.setData('')
})
},
placeholder的设置:下载confighelper插件放在plugins下即可生效