在vue中實(shí)現(xiàn)給每個頁面頂部設(shè)置title
實(shí)現(xiàn)思路很簡單:就是利用路由的導(dǎo)購守衛(wèi)beforeEach在每次頁面跳轉(zhuǎn)前更改對應(yīng)的title
1.首先在route里面給每個路由加上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ǔ)充知識:vue element tab標(biāo)簽頁文本溢出時,鼠標(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)給每個頁面頂部設(shè)置title就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. python爬蟲實(shí)戰(zhàn)之制作屬于自己的一個IP代理模塊2. Java程序的編碼規(guī)范(6)3. HTML 絕對路徑與相對路徑概念詳細(xì)4. python 利用toapi庫自動生成api5. Spring如何使用xml創(chuàng)建bean對象6. Android Studio設(shè)置顏色拾色器工具Color Picker教程7. python實(shí)現(xiàn)在內(nèi)存中讀寫str和二進(jìn)制數(shù)據(jù)代碼8. IntelliJ IDEA設(shè)置默認(rèn)瀏覽器的方法9. python實(shí)現(xiàn)PolynomialFeatures多項(xiàng)式的方法10. python實(shí)現(xiàn)讀取類別頻數(shù)數(shù)據(jù)畫水平條形圖案例
