<template>
  <div class="sidebar-container">
    <div class="nav-grid">
      <!-- 首页 -->
      <div class="nav-item" v-for="(items, index) in menuItems" :key="index" @click="handleNavClick(value)">
        <div class="nav-icon">
          <img style=" width:100%;" :src="items.icon">
        </div>
        <div class="nav-text">{{items.name}}</div>
      </div>

      
     
    
    </div>
  </div>
</template>

<script setup>
import { it } from 'element-plus/es/locales.mjs';
import { ref } from 'vue';
import { useRouter } from 'vue-router';

const router = useRouter();
const activeItem = ref('首页'); // 默认激活首页

const props = defineProps(['menuItems']);
// 导航菜单数据
// const navItems = ref([
//   { name: '首页', icon: 'home', path: '/' },
//   { name: '系统管理', icon: 'settings', path: '/system' },
//   { name: '建筑管理', icon: 'building', path: '/buildings' },
//   { name: '无人机管理', icon: 'drone', path: '/drones' },
//   { name: '火情管理', icon: 'fire', path: '/fires' },
//   { name: '数字孪生管理', icon: 'digital-twin', path: '/digital-twin' },
//   { name: '个人信息', icon: 'profile', path: '/profile' }
// ]);

// 导航点击处理
const handleNavClick = (item) => {
  activeItem.value = item.name;
  router.push(item.path);
};
</script>

<style scoped>
/* 主容器 */
.main-container {
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  padding: 15px;
  width: 100%;
  max-width: 600px;
}

/* 导航网格布局 */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  padding: 1rem;
}

/* 导航项 */
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: #666666 0 0 5px;
  /* background-color: rgb(185, 183, 183); */
}

.nav-item:hover {
  background-color: #f5f5f5;
}

/* 底部导航项 - 个人信息 */
.bottom-nav-item {
  grid-column: span 3; /* 横跨3列 */
  flex-direction: row;
  justify-content: flex-start;
  padding: 12px 15px;
  margin-top: 5px;
}

/* 导航图标 */
.nav-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 8px;
}

.bottom-nav-item .nav-icon {
  margin-bottom: 0;
  margin-right: 15px;
}

/* 导航文本 */
.nav-text {
  font-size: 14px;
  color: #666666;
  text-align: center;
}

.bottom-nav-item .nav-text {
  text-align: left;
}

/* 个人信息右侧线条 */
.nav-line {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: calc(100% - 130px);
  height: 2px;
  background-color: #ffd700;
}

/* 响应式调整 */
@media (max-width: 500px) {
  .nav-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .bottom-nav-item {
    grid-column: span 2;
  }
}
</style>