闫增涛
4 天以前 6227519a1bd9007aedae11b77b0b3b1851837c38
src/layout/components/header.vue
@@ -6,49 +6,64 @@
    </div>
    <el-menu
      mode="horizontal"
      :default-active="activeIndex"
      :default-active="seleStore.curTab"
      class="header-menu"
      router
    >
      <!-- <el-menu-item index="/">模型管理</el-menu-item>
      <!-- <el-menu-item index="/model" >模型管理</el-menu-item>
      <el-menu-item index="/simulation">可视化仿真</el-menu-item>
      <el-menu-item index="/systemManage">系统管理</el-menu-item> -->
      <el-menu-item
        v-for="(item,index) in navList"
        v-for="item in navList"
        :key="item.path"
        :index="item.path"
        @click="handleSelect(item.path, index)"
        @click="handleSelect(item.path)"
        >{{ item.name }}</el-menu-item
      >
    </el-menu>
    <div class="header-right">
      <div class="user-info" @click="handleUserClick">
        <el-avatar src="path/to/avatar.png"></el-avatar>
        <span>用户名</span>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import { ref, defineEmits } from "vue";
import { useRoute, useRouter } from "vue-router";
const router = useRouter();
const route = useRoute();
import { curStoreInfo } from "@/store/index";
const activeIndex = ref("/");
const router = useRouter();
const emit = defineEmits(["selectMenu"]);
const activeIndex = ref("model");
const seleStore = curStoreInfo();
const navList = ref([
  {
    name: "模型管理",
    path: "/model",
    path: "model",
  },
  {
    name: "可视化仿真",
    path: "/simulation",
    path: "simulation",
  },
  {
    name: "系统管理",
    path: "/systemManage",
    path: "systemManage",
  },
]);
const handleSelect = (path: string) => {
  console.log(path);
  activeIndex.value = path;
  router.push(path);
  // emit("selectMenu", path);
  router.push("/" + path);
  seleStore.setCurTab(path)
};
const handleUserClick = () => {
  router.push("/user/profile");
};
</script>