最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue富文本編輯器組件vue-quill-edit使用教程

 更新時(shí)間:2018年09月21日 11:29:31   作者:LIULIULIU666  
這篇文章主要為大家詳細(xì)介紹了vue富文本編輯器組件vue-quill-edit的使用教程,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

之前使用的富文本編輯器是uEditor,kindEditor,感覺不太方便。

近期項(xiàng)目vue單頁面,就使用vue-quill-edit這個(gè)編輯器組件吧!

一、安裝  cnpm install vue-quill-editor

二、引入

在main.js引入并注冊:

import VueQuillEditor from 'vue-quill-editor'
// require styles 引入樣式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

Vue.use(VueQuillEditor)

三、封裝組件

<template>
 <div class="quill_box">
 <quill-editor 
 v-model="content" 
 ref="myQuillEditor" 
 :options="editorOption" 
 @blur="onEditorBlur($event)" @focus="onEditorFocus($event)"
 @change="onEditorChange($event)">
 </quill-editor>
 </div>
 
</template> 
<script>
import Bus from "../../assets/utils/eventBus";

export default {
 data() {
 return {
 content:'',
 editorOption: {
 placeholder: "請編輯內(nèi)容",
 modules: {
  toolbar: [
  ["bold", "italic", "underline", "strike"],
  ["blockquote", "code-block"],
  [{ list: "ordered" }, { list: "bullet" }],
  [{ script: "sub" }, { script: "super" }],
  [{ indent: "-1" }, { indent: "+1" }],
  [{ size: ["small", false, "large", "huge"] }],
  [{ font: [] }],
  [{ color: [] }, { background: [] }],
  [{ align: [] }],
  [ "image"]
  ]
 }
 }
 };
 },
 props:[
 'contentDefault'
 ],
 watch:{
 contentDefault:function(){
 this.content = this.contentDefault;
 }
 },
 mounted:function(){
 this.content = this.contentDefault;
 },
 methods: {
 onEditorBlur() {
 //失去焦點(diǎn)事件
 // console.log('失去焦點(diǎn)');
 },
 onEditorFocus() {
 //獲得焦點(diǎn)事件
 // console.log('獲得焦點(diǎn)事件');
 },
 onEditorChange() {
 //內(nèi)容改變事件
 // console.log('內(nèi)容改變事件');
 Bus.$emit('getEditorCode',this.content)
 }
 }
};
</script> 

<style lang="less">
 .quill_box{
 .ql-toolbar.ql-snow{border-color:#dcdfe6;}
 .ql-container{height:200px !important;border-color:#dcdfe6;}
 .ql-snow .ql-picker-label::before {
 position: relative;
 top: -10px;
 }
 .ql-snow .ql-color-picker .ql-picker-label svg, .ql-snow .ql-icon-picker .ql-picker-label svg{position: relative;top:-6px;}
 }
</style>

四、引入使用

<my-editor :contentDefault="contentDefault"></my-editor>
components:{
 myEditor:myEditorComponent
 },

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

义马市| 镇江市| 乌海市| 九江县| 淮南市| 中方县| 方山县| 屯昌县| 二连浩特市| 克拉玛依市| 洱源县| 易门县| 沭阳县| 汾西县| 淮滨县| 花莲县| 集贤县| 台山市| 崇义县| 丁青县| 江城| 清流县| 广水市| 江门市| 茌平县| 龙陵县| 綦江县| 福贡县| 平顺县| 高淳县| 齐齐哈尔市| 聂荣县| 图们市| 郑州市| 方山县| 大新县| 武冈市| 肥东县| 永登县| 万源市| 高州市|