<script setup lang="ts">
import { UserOutlined } from "@vicons/antd";
import { logout } from "@/utils";
//头像下拉菜单
const avatarSelect = (key) => {
  switch (key) {
    case 1:
      doLogout();
      break;
  }
};

const avatarOptions = [
  {
    label: "退出登录",
    key: 1,
  },
];

// 退出登录
const doLogout = () => {
  logout();
};
</script>

<template>
  <div class="layout-header">
    <div class="layout-header-right">
      <div class="layout-header-trigger layout-header-trigger-min">
        <n-dropdown
          trigger="hover"
          @select="avatarSelect"
          :options="avatarOptions"
        >
          <div class="avatar">
            <n-avatar round>
              admin
              <template #icon>
                <UserOutlined />
              </template>
            </n-avatar>
          </div>
        </n-dropdown>
      </div>
    </div>
  </div>
</template>
<style scoped lang="scss">
.layout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 50px;
  box-shadow: 0 1px 4px rgb(0 21 41 / 8%);
  transition: all 0.2s ease-in-out;

  &-right {
    position: absolute;
    right: 20px;
  }
}
</style>
