在vue中實(shí)現(xiàn)給每個(gè)頁(yè)面頂部設(shè)置title
實(shí)現(xiàn)思路很簡(jiǎn)單:就是利用路由的導(dǎo)購(gòu)守衛(wèi)beforeEach在每次頁(yè)面跳轉(zhuǎn)前更改對(duì)應(yīng)的title
1.首先在route里面給每個(gè)路由加上meta屬性
2.在main.js里面加上導(dǎo)航守衛(wèi)
router.beforeEach((to,form,next) => {window.document.title = to.meta.title == undefined?’默認(rèn)標(biāo)題’:to.meta.titlenext()})
補(bǔ)充知識(shí):vue element tab標(biāo)簽頁(yè)文本溢出時(shí),鼠標(biāo)上去 Tooltip文字提示
重點(diǎn):el-tooltip標(biāo)簽內(nèi)加slot=“l(fā)abel”
<el-tooltip effect='dark' :content='item.stationName' placement='bottom-start' slot='label'> <span>{{item.stationName}}</span> </el-tooltip>
<div class='left'> <el-tabs tab-position='left' @tab-click='handleClick' > <el-tab-pane v-for='(item,index) in chargingStatusTitle' :key='index'> <el-tooltip effect='dark' :content='item.stationName' placement='bottom-start' slot='label'> <span>{{item.stationName}}</span> </el-tooltip> <div > </div> </el-tab-pane> </el-tabs > </div>
以上這篇在vue中實(shí)現(xiàn)給每個(gè)頁(yè)面頂部設(shè)置title就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. Warning: require(): open_basedir restriction in effect,目錄配置open_basedir報(bào)錯(cuò)問(wèn)題分析2. ASP.NET Core 5.0中的Host.CreateDefaultBuilder執(zhí)行過(guò)程解析3. ASP調(diào)用WebService轉(zhuǎn)化成JSON數(shù)據(jù),附j(luò)son.min.asp4. SharePoint Server 2019新特性介紹5. ASP中常用的22個(gè)FSO文件操作函數(shù)整理6. React+umi+typeScript創(chuàng)建項(xiàng)目的過(guò)程7. php網(wǎng)絡(luò)安全中命令執(zhí)行漏洞的產(chǎn)生及本質(zhì)探究8. 無(wú)線(xiàn)標(biāo)記語(yǔ)言(WML)基礎(chǔ)之WMLScript 基礎(chǔ)第1/2頁(yè)9. 三個(gè)不常見(jiàn)的 HTML5 實(shí)用新特性簡(jiǎn)介10. php測(cè)試程序運(yùn)行速度和頁(yè)面執(zhí)行速度的代碼
