最近使用iview admin写了个后台管理。本来使用textarea提交文本。后来需要增加图片,用富文本提交。。。那就没办法了
找了一些,自我感觉还是quill比较好用
话不多说
**
先下载:
npm install quill --save
推荐使用淘宝源
**
封装组件:
新建一个edit.vue
<style scoped>
.editor{
height: 300px;
}
</style>>
<template>
<div>
<div class="editor"></div>
<button v-on:click="getContent">查看内容</button>
</div>
</template>
<script>
import Quill from 'quill'
import 'quill/dist/quill.snow.css'
export default {
name: 'editor',
props: {
value: Object
},
data() {
return {
quill:null,
options: {
theme: 'snow'