1.第一步首先去ckeditor官網去下載editor文件,這里以ckeditor4為例
首先在index.html里引入js代碼
<script type="text/javascript" src="/static/ckeditor/ckeditor.js"></script>
2然后在webpack.base.conf.js里編寫
.
3.在需要使用的模塊里引入
<template> <div id="video"> video <textarea id="editor" rows="10" cols="80"></textarea> </div> </template> <script> import CKEDITOR from "CKEDITOR" export default{ name:'video', mounted() { CKEDITOR.replace("editor", {height: "300px", width: "100%", toolbar: "Full"}); var editor = CKEDITOR.instances.editor2; }, } </script> <style> </style>
然后保存運行你的vue項目,即可查看到