vue-ant-desgin 面包屑

复制代码
<template>
    <a-breadcrumb separator="/">
        <a-breadcrumb-item
            v-for="item in breadList"
            :key="item.path"
            :href="item.path"
        >
            <a :href="item.path"> {{ item.text }}</a>
        </a-breadcrumb-item>
    </a-breadcrumb>
</template>

<script>
export default {
    name: "breadCrumb",
    data() {
        return {
            breadList: [],
        };
    },
    watch: {
        $route() {
            this.getBreadcrumb();
        },
    },
    methods: {
        getBreadcrumb() {
            let matched = this.$route.matched;
            this.breadList = matched[matched.length - 1].meta.title;
        },
    },
    created() {
        this.getBreadcrumb();
    },
};
</script>

<style>
</style>
 {
        path: "cityCode",
        name: "cityCode",
        component: () =>
          import(/* webpackChunkName: "cityCode" */ "../views/basicDataManage/cityCode.vue"),
        meta: {
          keepAlive: true, // 需要缓存
          title: [
            {
              text: "基础数据",
            },
            {
              text: "数据管理",
            },
          ],
        },
      },
复制代码

 

posted @   Webwhl  阅读(82)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 提示词工程——AI应用必不可少的技术
· 地球OL攻略 —— 某应届生求职总结
· 字符编码:从基础到乱码解决
· SpringCloud带你走进微服务的世界
历史上的今天:
2021-12-01 git 拉去代码报错
2021-12-01 工厂模式
点击右上角即可分享
微信分享提示