欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue-admin-template模板添加tagsview的實(shí)現(xiàn)

 更新時(shí)間:2022年04月28日 09:43:47   作者:小飛豬咯咯  
本文主要介紹了vue-admin-template模板添加tagsview的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

一、從vue-element-admin復(fù)制文件

vue-admin-template\src\layout\components\TagsView 文件夾
vue-admin-template\src\store\modules\tagsView.js
#vue-admin-template\static 文件夾
#vue-admin-template\src\lang 文件夾
#vue-admin-template\src\utils\i18n.js

二、修改 vue-admin-template\src\layout\components\AppMain.vue

AppMain.vue文件,新增以下內(nèi)容:

<template>
  <section class="app-main">
    <transition name="fade-transform" mode="out-in">
     <!-- <router-view :key="key" />-->
      <keep-alive :include="cachedViews">
        <router-view></router-view>
      </keep-alive>
    </transition>
  </section>
</template>
export default {
  name: 'AppMain',
  computed: {
    cachedViews() {
      return this.$store.state.tagsView.cachedViews
    }/*,
    key() {
      return this.$route.path
    }*/
  }
}
<style lang="scss" scoped>
.app-main {
  /*50 = navbar  */
  min-height: calc(100vh - 50px);
  width: 100%;
  position: relative;
  overflow: hidden;
}
.fixed-header + .app-main {
  padding-top: 50px;
}

.hasTagsView {
  .app-main {
    /* 84 = navbar + tags-view = 50 + 34 */
    min-height: calc(100vh - 84px);
  }

  .fixed-header+.app-main {
    padding-top: 84px;
  }
}
</style>

三、修改vue-admin-template\src\layout\components\index.js

新增如下行:

export { default as TagsView } from './TagsView'

四、vue-admin-template\src\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 />
      </div>
      <tags-view />    <!-- 此處增加tag-->
      <app-main />
    </div>
  </div>
</template>
import { Navbar, Sidebar, AppMain, TagsView } from './components'
components: {
    Navbar,
    Sidebar,
    AppMain,
    TagsView
  },

五、修改 vue-admin-template\src\store\getters.js

增加:

visitedViews: state => state.tagsView.visitedViews,
cachedViews: state => state.tagsView.cachedViews,

六、修改 vue-admin-template\src\store\index.js

import tagsView from './modules/tagsView'
const store = new Vuex.Store({
  modules: {
    app,
    permission,
    settings,
    tagsView,
    user
  },
  getters
})

七、修改 vue-admin-template\src\main.js

import i18n from './lang' // Internationalization
new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})

八、修改vue-admin-template\src\settings.js 添加

tagsView: true,

九、修改vue-admin-template\src\store\modules\settings.js

const { showSettings, tagsView, fixedHeader, sidebarLogo } = defaultSettings

const state = {
  showSettings: showSettings,
  tagsView: tagsView,
  fixedHeader: fixedHeader,
  sidebarLogo: sidebarLogo
}

解決控制臺(tái)報(bào)錯(cuò):

1、刪除vue-admin-template\src\layout\components\TagsView\index.vue中routes方法

(因?yàn)闆]有用到權(quán)限校驗(yàn))

2、遍歷標(biāo)簽時(shí)可能報(bào)錯(cuò)

參考

https://github.com/PanJiaChen/vue-admin-template/issues/349

到此這篇關(guān)于vue-admin-template模板添加tagsview的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)vue-admin-template模板添加tagsview內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • ElementUI級(jí)聯(lián)選擇器實(shí)現(xiàn)同一父級(jí)下最多只能選中一個(gè)子級(jí)

    ElementUI級(jí)聯(lián)選擇器實(shí)現(xiàn)同一父級(jí)下最多只能選中一個(gè)子級(jí)

    本文主要介紹了ElementUI級(jí)聯(lián)選擇器實(shí)現(xiàn)同一父級(jí)下最多只能選中一個(gè)子級(jí),同一父級(jí)下的子節(jié)點(diǎn)單選,又可以選擇多個(gè)不同父級(jí)下的節(jié)點(diǎn),具有一定參考價(jià)值,感興趣的可以了解一下
    2023-10-10
  • Vue動(dòng)態(tài)添加屬性到data的實(shí)現(xiàn)

    Vue動(dòng)態(tài)添加屬性到data的實(shí)現(xiàn)

    在vue中請(qǐng)求接口中,一個(gè)請(qǐng)求方法可能對(duì)應(yīng)后臺(tái)兩個(gè)請(qǐng)求接口,所以請(qǐng)求參數(shù)就會(huì)有所不同。需要我們先設(shè)置共同的參數(shù),然后根據(jù)條件動(dòng)態(tài)添加參數(shù)屬性
    2022-08-08
  • Vue新玩具VueUse的具體用法

    Vue新玩具VueUse的具體用法

    VueUse 是一個(gè)基于 Composition API 的實(shí)用函數(shù)集合。本文就詳細(xì)的介紹了VueUse的具體用法,具有一定的參考價(jià)值,感興趣的可以了解一下
    2021-11-11
  • 詳解vue3中setUp和reactive函數(shù)的用法

    詳解vue3中setUp和reactive函數(shù)的用法

    這篇文章主要介紹了vue3函數(shù)setUp和reactive函數(shù)的相關(guān)知識(shí)及setup函數(shù)和reactive函數(shù)的注意點(diǎn),通過具體代碼給大家介紹的非常詳細(xì),需要的朋友可以參考下
    2021-06-06
  • Vue方法與事件處理器詳解

    Vue方法與事件處理器詳解

    這篇文章主要為大家詳細(xì)介紹了Vue方法與事件處理器,,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-12-12
  • vue data變量相互賦值后被實(shí)時(shí)同步的解決步驟

    vue data變量相互賦值后被實(shí)時(shí)同步的解決步驟

    這篇文章主要介紹了vue data變量相互賦值后被實(shí)時(shí)同步的解決步驟,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2020-08-08
  • vue.js實(shí)現(xiàn)開關(guān)(switch)組件實(shí)例代碼

    vue.js實(shí)現(xiàn)開關(guān)(switch)組件實(shí)例代碼

    這篇文章介紹了vue.js實(shí)現(xiàn)開關(guān)(switch)組件的實(shí)例代碼,文中通過示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-06-06
  • 深入探討Vue?3中的組合式函數(shù)編程方式

    深入探討Vue?3中的組合式函數(shù)編程方式

    Vue?3中引入了組合式函數(shù)編程方式,可以更好地實(shí)現(xiàn)代碼的復(fù)用和可維護(hù)性。通過定義可組合的函數(shù),可以將組件的邏輯和狀態(tài)進(jìn)行拆分和組合,實(shí)現(xiàn)更靈活的代碼組織方式。同時(shí),組合式函數(shù)也支持響應(yīng)式數(shù)據(jù)和生命周期鉤子函數(shù),更加貼近Vue開發(fā)的實(shí)際場(chǎng)景
    2023-05-05
  • Vue 2.5.2下axios + express 本地請(qǐng)求404的解決方法

    Vue 2.5.2下axios + express 本地請(qǐng)求404的解決方法

    下面小編就為大家分享一篇Vue 2.5.2下axios + express 本地請(qǐng)求404的解決方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2018-02-02
  • vue實(shí)現(xiàn)選項(xiàng)卡及選項(xiàng)卡切換效果

    vue實(shí)現(xiàn)選項(xiàng)卡及選項(xiàng)卡切換效果

    這篇文章主要介紹了vue實(shí)現(xiàn)選項(xiàng)卡選項(xiàng)卡切換效果,這里的Vue以單文件的形式引入,另外代碼在實(shí)現(xiàn)上會(huì)一步步的進(jìn)行優(yōu)化。需要的朋友可以參考下
    2018-04-04

最新評(píng)論