quill-editor默认的工具栏,是没有title提示的,我们可以手动给它添加一个title属性
代码如下:
data(){
return {
tooltips:[
{choice:'.ql-bold',title:'加粗'},
{choice:'.ql-size',title:'字体大小'},
{choice:'.ql-color',title:'字体颜色'},
{choice:'.ql-background',title:'背景颜色'},
{choice:'.ql-clean',title:'清除格式'},
]
}
}
mounted(){
docuemnt.getElementsByClassName('.quill-editor')[0].placeholder=''
for(let item of this.tooltips){
let tip = document.querySelector('.quill-editor' + item.choice)
if(!tip) continue
tip.setAttribute('title',item.title)
}
}