The use of rich text box Vue-quill-editor

Source: Internet
Author: User

Vue-quill Official website: https://www.npmjs.com/package/vue-quill-editor

Quill official Website: https://quilljs.com/docs/quickstart/

Basic usage is not introduced here, here are the following special usage:

How to add custom blots and Custom toolbar controls

<Template><Quilleditorref= "Editor"V-model= "Content": Options= "Editoroption">  <DivID= "Toolbar"Slots= "Toolbar">    <Selectclass= "Ql-size">          <optionvalue= "small">Small</option>          <optionselected>Conventional</option>          <optionvalue= "Large">Big</option>          <optionvalue= "huge">Large</option>        </Select>    <Buttontype= "button"class= "Ql-bold"></Button>    <Buttontype= "button"class= "Ql-italic"></Button>    <Buttontype= "button"class= "Ql-underline"></Button>    <Selectclass= "Ql-color"></Select>    <Buttontype= "button"class= "Ql-image"></Button>    <Buttontype= "button"class= "Ql-list"value= "Ordered"></Button>    <Buttontype= "button"class= "Ql-list"value= "Bullet"></Button>    <Selectclass= "Ql-align"></Select>    <!--Custom Controls -    <Button@click= "Addmyblot">Custom Buttons</Button>  </Div></Quilleditor></Template><Script>Import {Quill} from'Vue-quill-editor';//Get inlineConst Embed=Quill.import ('blots/embed'); class Myblot extends Embed {static Blotname= 'Myblot'; Static TagName= 'Myblot'; Static Create (value) {const node=super.create (value); Node.innerhtml=value; Node.setattribute ('ID', value); returnnode; }}//RegisterQuill.register (myblot); Exportdefault{data () {return{content:"', Editoroption: {placeholder:'Please enter text ...', Modules: {toolbar:'#toolbar',},},} }, method: {//Vue-quill's small bug    //Although it is a two-way binding, it cannot be changed directly to Content,ql-editor's innerHTML, otherwise the value of blot will become truesetcontent (InnerHTML) {setTimeout ()={Const Quill=  This. $refs ['Editor'].quill; Quill.container.querySelector ('. Ql-editor'). InnerHTML=InnerHTML}) }, Addmyblot () {Const Quill=  This. $refs ['Editor'].quill; Quill.insertembed (Index,'Myblot', 'Balabala ... '); }  }}</Script>

The use of rich text box Vue-quill-editor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.