最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue實(shí)現(xiàn)動(dòng)態(tài)面包屑導(dǎo)航

 更新時(shí)間:2022年04月13日 10:54:05   作者:風(fēng)如也  
這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)動(dòng)態(tài)面包屑導(dǎo)航的使用方法,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了vue實(shí)現(xiàn)動(dòng)態(tài)面包屑導(dǎo)航的具體代碼,供大家參考,具體內(nèi)容如下

動(dòng)態(tài)面包屑導(dǎo)航是根據(jù)路由中的matched獲取到的
單獨(dú)提取出面包屑導(dǎo)航欄組件

<template>
? <el-breadcrumb class="app-breadcrumb" separator="/">
? ? <transition-group name="breadcrumb">
? ? ? <el-breadcrumb-item v-for="item in levelList" :key="item.path" :to="{ path: item.path }">
? ? ? ? <span>{{ item.meta.title }}</span>
? ? ? </el-breadcrumb-item>
? ? </transition-group>
? </el-breadcrumb>
</template>

<script>
export default {
? data () {
? ? return {
? ? ? levelList: null
? ? }
? },
? watch: {
? ? $route () {
? ? ? this.getBreadcrumb()
? ? }
? },
? created() {
? ? this.getBreadcrumb()
? },
? methods: {
? ? getBreadcrumb () {
? ? ? let matched = this.$route.matched.filter(item => item.meta && item.meta.title)
? ? ? const first = matched[0]
? ? ? if (!this.isIndex(first)) {
? ? ? ? matched = [{ path: '/index', meta: { title: '首頁(yè)' } }].concat(matched)
? ? ? ? this.levelList = matched
? ? ? } else {
? ? ? ? this.levelList = [{ path: '/index', meta: { title: '首頁(yè)' } }]
? ? ? }
? ? },
? ? isIndex (route) {
? ? ? const redirect = route && route.redirect
? ? ? if (!redirect) {
? ? ? ? return false
? ? ? }
? ? ? return redirect === '/index'
? ? }
? },
}
</script>

<style lang="scss">
/* breadcrumb transition */
.breadcrumb-enter-active,
.breadcrumb-leave-active {
? transition: all .5s;
}

.breadcrumb-enter,
.breadcrumb-leave-active {
? opacity: 0;
? transform: translateX(20px);
}

.breadcrumb-move {
? transition: all .5s;
}

.breadcrumb-leave-active {
? position: absolute;
}

.app-breadcrumb.el-breadcrumb {
? margin-left: 8px;
}
</style>

在布局組件中應(yīng)用

<!-- 面包屑 -->
<dBreadcrumb class="breadcrumb-container" />

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

闵行区| 融水| 海南省| 涞水县| 金坛市| 樟树市| 岐山县| 建阳市| 贵州省| 榆社县| 贺兰县| 防城港市| 遂川县| 通道| 太康县| 囊谦县| 庆云县| 和顺县| 大足县| 鲜城| 故城县| 辽宁省| 东台市| 宁都县| 边坝县| 班戈县| 加查县| 揭东县| 汾阳市| 长垣县| 达孜县| 宾阳县| 化隆| 崇阳县| 佳木斯市| 宝山区| 遵化市| 栾城县| 罗平县| 宜城市| 鄂伦春自治旗|