vue-quill-editor如何限制字数
1.<quillEditorv-model="form.info"style="height:200px"ref="myQuillEditor"@change="onEditorChange($event)":options="editorOption"></quillEditor><div style="text-align:right;margin-right:1
·
1.
<quillEditor
v-model="form.info"
style="height:200px"
ref="myQuillEditor"
@change="onEditorChange($event)"
:options="editorOption">
</quillEditor>
<div style="text-align:right;margin-right:10px;margin-bottom:-5px">
{{TiLength}}/2000
</div>
2.data里面:
3. mounted里面
mounted(){
//数据初始化
this.TiLength =this.$refs.myQuillEditor.quill.getLength() - 1
},
4.methods里面
methods:{
onEditorChange(event) {
event.quill.deleteText(2000,1);
if(this.form.info===''){
this.TiLength = 0
}
else{
this.TiLength = event.quill.getLength()-1
}
},
更多推荐
已为社区贡献7条内容
所有评论(0)