国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

Vue 實現對quill-editor組件中的工具欄添加title

瀏覽:113日期:2022-12-19 13:03:02

前言:quill-editor組件中的工具欄都是英文,而且最難受的時沒有title提示,要怎樣給他添加title,并且是中文的title提示呢?

一、創建一個quill-title.js文件

①、在其中插入以下代碼

const titleConfig = { ’ql-bold’:’加粗’, ’ql-color’:’顏色’, ’ql-font’:’字體’, ’ql-code’:’插入代碼’, ’ql-italic’:’斜體’, ’ql-link’:’添加鏈接’, ’ql-background’:’背景顏色’, ’ql-size’:’字體大小’, ’ql-strike’:’刪除線’, ’ql-script’:’上標/下標’, ’ql-underline’:’下劃線’, ’ql-blockquote’:’引用’, ’ql-header’:’標題’, ’ql-indent’:’縮進’, ’ql-list’:’列表’, ’ql-align’:’文本對齊’, ’ql-direction’:’文本方向’, ’ql-code-block’:’代碼塊’, ’ql-formula’:’公式’, ’ql-image’:’圖片’, ’ql-video’:’視頻’, ’ql-clean’:’清除字體樣式’}; export function addQuillTitle(){ const oToolBar = document.querySelector(’.ql-toolbar’), aButton = oToolBar.querySelectorAll(’button’), aSelect = oToolBar.querySelectorAll(’select’); aButton.forEach(function(item){ if(item.className === ’ql-script’){ item.value === ’sub’ ? item.title = ’下標’: item.title = ’上標’; }else if(item.className === ’ql-indent’){ item.value === ’+1’ ? item.title =’向右縮進’: item.title =’向左縮進’; }else{ item.title = titleConfig[item.classList[0]]; } }); aSelect.forEach(function(item){ item.parentNode.title = titleConfig[item.classList[0]]; });}

②、在頁面中應用

<template> <quill-editor v-model='content' > </quill-editor></template> <script> import { quillEditor } from ’vue-quill-editor’ import { addQuillTitle } from ’./quill-title.js’ export default { components: { quillEditor }, mounted(){ addQuillTitle(); }, data() { return { content: ’<h2>freddy</h2>’, } } }</script>

③、運行結果

Vue 實現對quill-editor組件中的工具欄添加title

像這樣鼠標移入的時候就會顯示title了。

補充知識:自定義設置vue-quill-editor toolbar的title屬性

直接看代碼吧~

const titleConfig = { ’ql-bold’:’加粗’, ’ql-color’:’字體顏色’, ’ql-font’:’字體’, ’ql-code’:’插入代碼’, ’ql-italic’:’斜體’, ’ql-link’:’添加鏈接’, ’ql-background’:’背景顏色’, ’ql-size’:’字體大小’, ’ql-strike’:’刪除線’, ’ql-script’:’上標/下標’, ’ql-underline’:’下劃線’, ’ql-blockquote’:’引用’, ’ql-header’:’標題’, ’ql-indent’:’縮進’, ’ql-list’:’列表’, ’ql-align’:’文本對齊’, ’ql-direction’:’文本方向’, ’ql-code-block’:’代碼塊’, ’ql-formula’:’公式’, ’ql-image’:’圖片’, ’ql-video’:’視頻’, ’ql-clean’:’清除字體樣式’};export function addQuillTitle(){ const oToolBar = document.querySelector(’.ql-toolbar’), aButton = oToolBar.querySelectorAll(’button’), aSelect = oToolBar.querySelectorAll(’select’), aSpan= oToolBar.querySelectorAll(’span’); aButton.forEach((item)=>{ if(item.className === ’ql-script’){ item.value === ’sub’ ? item.title = ’下標’: item.title = ’上標’; }else if(item.className === ’ql-indent’){ item.value === ’+1’ ? item.title =’向右縮進’: item.title =’向左縮進’; }else if(item.className === ’ql-list’){ item.value===’ordered’ ? item.title=’有序列表’ : item.title=’無序列表’}else if(item.className === ’ql-header’){ item.value === ’1’ ? item.title = ’標題H1’: item.title = ’標題H2’;}else{ item.title = titleConfig[item.classList[0]]; } }); aSelect.forEach((item)=>{ if(item.className!=’ql-color’&&item.className!=’ql-background’){ item.parentNode.title = titleConfig[item.classList[0]]; } }); aSpan.forEach((item)=>{ if(item.classList[0]===’ql-color’){ item.title = titleConfig[item.classList[0]]; }else if(item.classList[0]===’ql-background’){ item.title = titleConfig[item.classList[0]]; } });}//how to use//import { addQuillTitle } from ’./set-quill-title.js’//addQuillTitle(); --use in mouted//自定義 set title

以上這篇Vue 實現對quill-editor組件中的工具欄添加title就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持好吧啦網。

標簽: Vue
相關文章:
主站蜘蛛池模板: 成人性毛片 | 亚洲wwww | 国产区更新 | 成年男女免费视频网站 | a高清免费毛片久久 | 婷婷色综合久久五月亚洲 | 男女性高清爱潮视频免费观看 | 三级做人爱c视频18三级 | 欧美成 人h版在线观看 | 又刺激又黄的一级毛片 | 日本不卡一区在线 | 97免费视频观看 | 国产精品日本一区二区不卡视频 | 国产精品久久久久久久久久一区 | 国内精品免费一区二区三区 | 久草视频中文在线 | 日韩av线上| 男女无遮掩做爰免费视频软件 | 午夜成人在线视频 | 欧美一级网址 | 欧美一级看片免费观看视频在线 | 韩国黄色一级毛片 | 欧美 自拍 | 欧洲一级毛片 | 欧美国产精品 | 亚洲精品一区二区三区第四页 | 日本美女视频韩国视频网站免费 | 成人午夜影院在线观看 | 奇米影视7777久久精品 | 成人在线视频免费 | 久久综合网址 | 美女网站免费观看视频 | 午夜宅男宅女看在线观看 | 中文字幕 亚洲精品 第1页 | 免费人成网站在线播放 | 好看毛片 | 欧美视频久久久 | 国产日韩精品欧美一区 | 欧美成人免费全部观看天天性色 | 黄频免费影院 | 精品一区二区影院在线 |