<template>
  <div class="root">
    <div class="header">
      <img class="logo" src="../assets/imgs/logo.png" alt="logo" />
      <h2>政务·渝路智管</h2>
      <div class="user">
        <el-icon :size="24"><User /></el-icon>
      </div>
    </div>
    <div class="content">
      <div class="content-leftbar">
        <MenuBar></MenuBar>
      </div>
      <div class="content-main">
        <div class="breadcrumb-wrapper">
          <Breadcrumb ref="breadcrumbRef" @breadcrumb-change="handleBreadcrumbChange"></Breadcrumb>
        </div>
        <div class="router-wrapper">
          <router-view></router-view>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import MenuBar from "../component/MenuBar/index.vue";
import Breadcrumb from '../component/Breadcrumb/index.vue';
import { User } from '@element-plus/icons-vue'
import { ref } from 'vue'

const breadcrumbRef = ref(null)

const handleBreadcrumbChange = (breadcrumbList) => {
  console.log('面包屑变更:', breadcrumbList)
}
</script>

<style lang="scss" scoped>
.root {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.header {
  height: 64px;
  width: 100%;
  background-image: url("../assets/imgs/header.png");
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: space-between;
  .logo {
    width: 42px;
    height: 42px;
    margin-left: 16px;
    margin-right: 16px;
  }
  .user {
    margin-left: auto;
    cursor: pointer;
    margin-right: 16px;
  }
}
.content {
  height: calc(100% - 64px);
  width: 100%;
  display: flex;
}
.content-leftbar {
  width: 248px;
  height: 100%;
  background-image: url("../assets/imgs/menu.png");
  background-size: cover;
  background-position: center;
}
.content-main {
  width: calc(100% - 248px);
  height: 100%;
  display: flex;
  flex-direction: column;
}
.breadcrumb-wrapper {
  height: 40px;
  min-height: 40px;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e4e7ed;
}
.router-wrapper {
  flex: 1;
  height: calc(100% - 40px);
  overflow: hidden;
}
</style>