<!--
 * @Author: 曹捷
 * @Date: 2020-04-22 14:28:38
 * @LastEditors: 曹捷
 * @LastEditTime: 2021-09-24 23:02:17
 * @Description:  子应用 面包屑
  1放在header里面
  2放在body里面 breadcrumb-content

  面包屑规则修改详情界面规范 
  详情界面路径必须在父路径之后增加路径
 -->
<template>
  <a-breadcrumb class="app-breadcrumb" separator="/">
    <a-breadcrumb-item class="bread-item" :key="'bread' + index" v-for="(item, index) in levelList">
      <span class="no-redirect"
        v-if="item.path === 'noRedirect' || index == levelList.length - 1">{{ item[sysConfig.menu.name] }}</span>
      <a @click.prevent="handleLink(item)" v-else>{{ item[sysConfig.menu.name] }}</a>
    </a-breadcrumb-item>
  </a-breadcrumb>
</template>

<script>
import crumbMix from './crumb'
export default {
  mixins: [crumbMix],
  data () {
    return {
    }
  },
  created () {
  },
  methods: {
    findLastRoute (arr) {
      // 子应用
      // 当前路径 系统菜单未设置 只有最后一层,需要设置mate parentPath对应 后台设置的菜单path
      let configPath = this.sysConfig.menu.url
      let lastRoute = this.sysMenuList.find((item) => {
        return this.$route.meta.parentPath === item[configPath]
      })
      if (lastRoute) {
        let detailsInfo = {}
        detailsInfo[this.sysConfig.menu.name] = this.$route.meta.name
        arr.push(detailsInfo)
      }
      return lastRoute
    },
  },
}
</script>

<style lang="less" scoped>
.app-breadcrumb {
  display: inline-block;
  font-size: 14px;
  line-height: 50px;
  margin-left: 8px;
  .ant-breadcrumb-link a {
    // color: #1890ff;
  }
  .no-redirect {
    // color: #97a8be;
    cursor: text;
  }
}
// 面包屑在主体里面
.app-breadcrumb.breadcrumb-content {
  line-height: normal !important;
  .breadcrumb {
    float: right;
    padding-right: 20px;
  }
}
</style>
