vue-admin-template配置快捷導(dǎo)航的代碼(標(biāo)簽導(dǎo)航欄)
vue-element-admin有關(guān)快捷導(dǎo)航說明
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對應(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會被固定在 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)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
vue自定義移動端touch事件之點(diǎn)擊、滑動、長按事件
這篇文章主要介紹了vue自定義移動端touch事件之點(diǎn)擊、滑動、長按事件的實(shí)例代碼,需要的朋友可以參考下2018-07-07elementui中的el-cascader級聯(lián)選擇器的實(shí)踐
本文主要介紹了elementui中的el-cascader級聯(lián)選擇器的實(shí)踐,文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2021-10-10vue中Form 表單的 resetFields() 失效原因及問題解決
在Vue項(xiàng)目中,使用formRef.value.resetFields()方法重置表單時可能遇到不起作用的問題,下面就來介紹一下如何解決,感興趣的可以了解一下2024-09-09vue用h()函數(shù)創(chuàng)建Vnodes的實(shí)現(xiàn)
Vue提供了一個h()函數(shù)用于創(chuàng)建vnodes,本文就來介紹一下vue用h()函數(shù)創(chuàng)建Vnodes的實(shí)現(xiàn),具有一定的參考價值,感興趣的可以了解一下2024-01-01vue3.0 CLI - 2.3 - 組件 home.vue 中學(xué)習(xí)指令和綁定
這篇文章主要介紹了vue3.0 CLI - 2.3 - 組件 home.vue 中學(xué)習(xí)指令和綁定的相關(guān)知識,本文通過實(shí)例代碼相結(jié)合的形式給大家介紹的非常詳細(xì) ,需要的朋友可以參考下2018-09-09vue+elementUI 復(fù)雜表單的驗(yàn)證、數(shù)據(jù)提交方案問題
這篇文章主要介紹了vue+elementUI 復(fù)雜表單的驗(yàn)證、數(shù)據(jù)提交方案,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價值,需要的朋友可以參考下2019-06-06