<template>
  <div class="custom-bread-crumb">
    <Breadcrumb :style="{fontSize: `${fontSize}px`}">
      <BreadcrumbItem v-for="item in list" :to="item.to" :key="`bread-crumb-${item.name}`">
        <!-- <Icon style="margin-right: 4px;" :type="item.icon || ''"/> -->
        <Icon v-if="item.icon && item.icon.indexOf('iconfont') === -1" size="26" :type="item.icon" />
        <Icon v-else :custom="item.icon" size="26"></Icon>
        {{ showTitle(item) }}
      </BreadcrumbItem>
    </Breadcrumb>
  </div>
</template>
<script>
import { showTitle } from '@/utils'
export default {
  name: 'customBreadCrumb',
  props: {
    list: {
      type: Array,
      default: () => []
    },
    fontSize: {
      type: Number,
      default: 18
    },
    showIcon: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    showTitle (item) {
      return showTitle(item, this)
    },
    isCustomIcon (iconName) {
      return iconName.indexOf('_') === 0
    },
    getCustomIconName (iconName) {
      return iconName.slice(1)
    }
  }
}
</script>
<style lang="less">
.custom-bread-crumb {
  display: inline-block;
  vertical-align: top;
  .ivu-breadcrumb {
    color: #111827;
  }
}
</style>
