<template>
  <el-breadcrumb separator-class="el-icon-arrow-right">
    <el-breadcrumb-item
      v-for="(item,index) in breadCrumbList"
      :key="item.path"
    >
      <span v-if="index === 0">{{ item.name }}</span>
      <a :to="item.path" v-else>{{ item.name }}</a>
    </el-breadcrumb-item>
  </el-breadcrumb>
</template>

<script>
export default {
  name: 'BreadCrumb',
  computed: {
    breadCrumbList () {
      return this.$route.matched.filter(item => item.path)
    }
  }
}
</script>
