這篇文章主要介紹如何實(shí)現(xiàn)iview-ui導(dǎo)航欄路徑配置,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
碌曲網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)建站!從網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、響應(yīng)式網(wǎng)站設(shè)計(jì)等網(wǎng)站項(xiàng)目制作,到程序開發(fā),運(yùn)營(yíng)維護(hù)。創(chuàng)新互聯(lián)建站2013年開創(chuàng)至今到現(xiàn)在10年的時(shí)間,我們擁有了豐富的建站經(jīng)驗(yàn)和運(yùn)維經(jīng)驗(yàn),來保證我們的工作的順利進(jìn)行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)建站。
示例
//router.js let routes = [ { path: '/', redirect: '/admin', }, { path: '/login', name: 'login', meta: {title: '登錄'}, component: () => import('./components/login.vue') }, { path: '/admin', name: 'admin', meta: {title: '主頁(yè)'}, component: () => import('./components/admin.vue'), children: [ { path: 'operation', name: 'operation', meta: {title: '運(yùn)營(yíng)管理'}, component: () => import('./components/admin/operation.vue') }, { path: 'order', name: 'order', meta: {title: '訂單中心'}, redirect: 'order/index', component: () => import('./components/admin/order.vue'), children: [ { path: 'index', name: 'index', meta: {title: ''}, component: () => import('./components/admin/ordercenter.vue') }, { path: 'detail', name: 'detail', meta: {title: '訂單詳情'}, component: () => import('./components/admin/orderdetail.vue') }, ] }, ] }, ] export default routes
這個(gè)是我部分的router路徑配置表
/*面包屑路徑處理*/ eve_breadcrumbItem_change(){ var list = this.$route.fullPath.split('/')//list[0]:是空格 this.BreadcrumbItem = [] function fn(obj, arr, index,self) { if (obj.hasOwnProperty('children')&&obj['children'].length>0) { for (let one of obj.children) { if (one.name != 'index' && one.name == arr[index]) { self.BreadcrumbItem.push({'title': one.meta.title, 'path': list.slice(0,index+1).join('/')}) return one.hasOwnProperty('children')&&one['children'].length>0?fn(one,arr,index+1,self):false } } } } for(let one of this.$router.options.routes){ if(one.hasOwnProperty('name')&&one.name == list[1]){ this.BreadcrumbItem.push({'title': one.meta.title, 'path': one.path}) fn(one,list,2,this) } } }
這個(gè)是就是本文的重點(diǎn),其實(shí)也簡(jiǎn)單,就是遞歸了下路徑名重新組裝了下數(shù)據(jù)給面包屑傳過去
watch: { '$route'(to, from) { this.eve_breadcrumbItem_change() } }, ... mounted() { this.eve_breadcrumbItem_change() },
使用也簡(jiǎn)單,無非watch檢測(cè)下路徑變化,避免刷新頁(yè)面時(shí)沒路徑,在mounted里再調(diào)用一下。
以上是“如何實(shí)現(xiàn)iview-ui導(dǎo)航欄路徑配置”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
文章標(biāo)題:如何實(shí)現(xiàn)iview-ui導(dǎo)航欄路徑配置
分享地址:http://jinyejixie.com/article42/pspihc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供全網(wǎng)營(yíng)銷推廣、網(wǎng)站收錄、App開發(fā)、響應(yīng)式網(wǎng)站、App設(shè)計(jì)、虛擬主機(jī)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
網(wǎng)頁(yè)設(shè)計(jì)公司知識(shí)