vue-admin-template配置快捷導(dǎo)航的代碼(標(biāo)簽導(dǎo)航欄)
vue-element-admin有關(guān)快捷導(dǎo)航說(shuō)明
1、添加標(biāo)簽
@/layout/components/AppMain.vue添加:
<template>
<section class="app-main">
<transition name="fade-transform" mode="out-in">
<keep-alive :include="cachedViews"> <!-- 新增 -->
<router-view :key="key" />
</keep-alive> <!-- 新增 -->
</transition>
</section>
</template>
2、復(fù)制admin項(xiàng)目中的文件
@/layout/components/TagsView
@/store/modules/tagsView.js
到template對(duì)應(yīng)的目錄下
3、修改文件
@store/getters.js
const getters = {
sidebar: state => state.app.sidebar,
device: state => state.app.device,
token: state => state.user.token,
avatar: state => state.user.avatar,
name: state => state.user.name,
visitedviews: state => state.tagsview.visitedviews //新增
}
export default getters
@store/index.js
import tagsView from './modules/tagsView' //新增
Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
app,
settings,
user,
tagsView //新增
},
getters
})
export default store
@\layout\index.vue
<template>
<div :class="classObj" class="app-wrapper">
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
<sidebar class="sidebar-container" />
<div class="main-container">
<div :class="{'fixed-header':fixedHeader}">
<navbar />
<tags-view /> <!-- 新增 -->
</div>
<app-main />
</div>
</div>
</template>
<script>
import { Navbar, Sidebar, AppMain,TagsView } from './components' //新增
@layout\components\index.js
export { default as TagsView } from './TagsView' // 新增
Affix 固釘
當(dāng)在聲明路由是 添加了 Affix 屬性,則當(dāng)前tag會(huì)被固定在 tags-view中(不可被刪除)。

{
path: '/',
component: Layout,
redirect: '/dashboard',
children: [
{
path: 'dashboard',
component: () => import('@/views/dashboard/index'),
name: 'dashboard',
meta: { title: 'dashboard', icon: 'dashboard', affix: true }
}
]
},
總結(jié)
到此這篇關(guān)于vue-admin-template配置快捷導(dǎo)航(標(biāo)簽導(dǎo)航欄)的文章就介紹到這了,更多相關(guān)vue-admin-template導(dǎo)航內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
vue3+vite使用History路由模式打包部署項(xiàng)目的步驟及注意事項(xiàng)
這篇文章主要介紹了vue3+vite使用History路由模式打包部署項(xiàng)目的步驟及注意事項(xiàng),配置過(guò)程包括在Vue項(xiàng)目中設(shè)置路由模式、調(diào)整打包配置以及Nginx服務(wù)器的配置,正確的部署配置能夠確保應(yīng)用順利運(yùn)行,提升用戶體驗(yàn),需要的朋友可以參考下2024-10-10
Vue-admin-template?添加、跳轉(zhuǎn)子頁(yè)面問(wèn)題
這篇文章主要介紹了Vue-admin-template?添加、跳轉(zhuǎn)子頁(yè)面問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-10-10
vue實(shí)現(xiàn)自定義日期組件功能的實(shí)例代碼
這篇文章主要介紹了vue自定義日期組件的實(shí)現(xiàn)代碼,代碼簡(jiǎn)單易懂,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2018-11-11
vue項(xiàng)目登錄頁(yè)面實(shí)現(xiàn)記住用戶名和密碼的示例代碼
本文主要介紹了vue項(xiàng)目登錄頁(yè)面實(shí)現(xiàn)記住用戶名和密碼的示例代碼,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2023-07-07
vue.set向?qū)ο罄镌黾佣鄬訑?shù)組屬性不生效問(wèn)題及解決
這篇文章主要介紹了vue.set向?qū)ο罄镌黾佣鄬訑?shù)組屬性不生效問(wèn)題及解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-04-04
Vue純前端使用exceljs導(dǎo)出excel文件的完整圖文教程
這篇文章將一步一步為大家詳細(xì)介紹一下exceljs插件中的使用,以及如何使用exceljs導(dǎo)出excel文件,感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2025-03-03

