<script setup name='breadcrumb'>
import { watch, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
// import store from '@/store'
const route = useRoute(),
  router = useRouter(),
  routeName = ref(),
  breadcrumbs = ref([]),
  goBack = () => {
    router.go(-1)
  }
watch(
  route,
  (val) => {
    routeName.value = route.meta.title
    breadcrumbs.value = route.matched.filter((item, index) => index !== 0)
  },
  { immediate: true, deep: true }
)

</script>

<template>
  <div class="ml-20 mt-10">
    <div class="flex items-center">
      <div
        class="flex items-center mr-5 backsize"
        @click="goBack"
      >
        <el-icon>
          <ArrowLeft />
        </el-icon>返回
      </div>
      <el-breadcrumb separator="/">
        <!--        <el-breadcrumb-item-->
        <!--          v-for="tag in store.appStore.tagNavList"-->
        <!--          :key="tag.path"-->
        <!--          :to="{ name: tag.path, query:tag.query || {}, params: tag.params || {}}"-->
        <!--        >{{ tag.name }}</el-breadcrumb-item>-->
        <el-breadcrumb-item v-for="item in breadcrumbs" :key="item.name">
          {{ item.meta.title }}
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="mt-8 font-semibold routeNameSize"><span>{{ routeName }}</span><img class="rightTopLogo" src="../../assets/images/rightTopLogo.png" alt="" /></div>
  </div>
</template>

<style lang='less' scoped>
.backsize{
    cursor: pointer;
    font-size: 14px;
}
.routeNameSize {
  overflow: hidden;
  font-size: 20px;
  .rightTopLogo{
  position: absolute;
  top: 0;
  right: 0;
}
}

</style>
