<!--
 * @Descripttion: 当前组件信息
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2018-10-10 14:44:45
 * @LastEditors: 无尘
 * @LastEditTime: 2020-12-04 17:09:57
 -->
<template>
  <div class="navwrap border-box">
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <template v-for="(item, index) in navpath">
        <template v-if="!!item.path">
          <el-breadcrumb-item :key="'nav' + index" :to="{ path: item.path }" @click="changeRoute(item.path, item.relocation)">
            <span class="el-breadcrumb__inner is-link" @click="changeRoute(item.path, item.relocation)">
              {{ item.name }}
            </span>
          </el-breadcrumb-item>
        </template>
        <template v-else>
          <el-breadcrumb-item :key="'nav' + index">{{ item.name }}</el-breadcrumb-item>
        </template>
      </template>
    </el-breadcrumb>
  </div>
</template>

<script>
import { postRequest } from '@/api/api';
import errMsg from '@/common/js/error';
export default {
  name: 'navpath',
  data() {
    return {
      projectName: 'member' // 当前项目名
      // navpath: [
      //   {
      //     name: '首页',
      //     path: ''
      //   },
      //   {
      //     name: '会员标签',
      //     path: ''
      //   },

      // ],
    };
  },
  props: {
    navpath: {
      type: Array,
      default: function() {
        return [];
      }
    },
    slotFlag: {
      type: Boolean,
      default: false
    },
    navtip: {
      type: Boolean,
      default: false
    },
    subNavText: {
      type: String,
      default: ''
    }
  },
  methods: {
    changeRoute(path, relocation) {
      let that = this;
      if (relocation) {
        window.location.href = path;
      } else {
        that.$router.push(path);
      }
    },

  }
};
</script>

<style scoped>
.navwrap {
  padding: 12px 20px;
}
.boxbttom {
  border-bottom: 1px solid #e4e7ed;
}
.boxshow {
  border-bottom: 1px solid #e4e7ed;
  box-shadow: 5px -1px 5px #dfdfdf;
}
.navtitle {
  margin: 24px 0 0 0;
  font-size: 20px;
  color: #303133;
  font-weight: 500;
}
.navtip {
  width: 100%;
  height: 38px;
  line-height: 38px;
  font-size: 13px;
  border-radius: 2px;
  color: #606266;
  background-color: #f4f4f5;
}
.navmTop {
  margin-top: 25px;
}
.navtipcolor {
  margin: 0 12px;
  color: #2f54eb;
}
.el-breadcrumb__inner.is-link:hover, .el-breadcrumb__inner a:hover {
  color: #2f54eb;
}

.el-breadcrumb__item:last-child .el-breadcrumb__inner,
.el-breadcrumb__item:last-child .el-breadcrumb__inner a,
.el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover,
.el-breadcrumb__item:last-child .el-breadcrumb__inner:hover {
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  color: #303133;
}
</style>
