<template>
  <div class="layout-container">
    <Header class="header"/>
    <div class="body">
      <header style="height: 50px">
        <div class="center-wrapper">
          <div class="childMenu">
            <router-link :to="item.path" class="child-item" v-for="(item,index) in childMenuList" :key="index">
              {{ item.name }}
            </router-link>
          </div>
        </div>
      </header>
      <main class="layout-main" style="margin-top: 24px">
        <router-view/>
      </main>
    </div>
    <Footer class="footer"/>
  </div>
</template>

<style scoped lang="scss">
.body {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.childMenu {
  width: 100%;
  height: 50px;
  background: #fff;
  display: flex;
  align-items: center;
  border-radius: 8px;

  .child-item {
    width: 136px;
    display: inline-block;
    color: #151515;
    outline: none;
    text-decoration: none;
    font-size: 18px;
    height: 50px;
    position: relative;
    line-height: 50px;
    text-align: center;

    &::before {
      content: '';
      position: absolute;
      right: 0;
      top: 50%;
      display: block;
      width: 2px;
      height: 16px;
      background: #D8D8D8;
      border-radius: 1px;
      transform: translate(0, -50%);
    }

    &:last-child::before {
      display: none;
    }
  }

  .router-link-active:after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background-color: #4D6DE4; // 下划线颜色
    position: absolute;
    bottom: 0; // 调整下划线与文字的距离
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
  }
}

a.router-link-active.router-link-exact-active.child-item {
  color: #4D6DE4;
}
</style>


<script setup lang="ts">
import "@/assets/scss/layout.scss"
import Header from "@/components/common/Header.vue";
import Footer from "@/components/common/Footer.vue";
import {ref} from "vue";

const childMenuList = ref([
  {
    name: '商品',
    path: '/inventory/goods',
  },
  {
    name: '采购',
    path: '/inventory/inventory',
  },
  {
    name: '领用',
    path: '/inventory/apply',
  },
  {
    name: '供应商',
    path: '/inventory/supplier',
  },
  {
    name: '盘点',
    path: '/inventory/check',
  }
])
</script>