<script setup lang="ts">
import { ref } from 'vue'
// import url from '../assets/home/trademark.png';
//选中的索引
const activeIndex = ref<string>('1')

//选中菜单事件
const handleSelect = (key: string, keyPath: []) => {
    // console.log(key, keyPath)
    activeIndex.value = key;
}
</script>

<template>
    <div class="header_p">
        <div class="header_image">
            <img style="width: 239px; height: 55px" src="../assets/home/trademark.png"></img>
        </div>
        <el-menu :default-active="activeIndex" class="el-menu-demo" style="display: flex;" mode="horizontal"
            :ellipsis="false" @select="handleSelect">
            <el-menu-item index="1">首页</el-menu-item>
            <el-menu-item index="2">科普乐园</el-menu-item>
            <el-menu-item index="3">留言社区</el-menu-item>
            <!-- <el-badge :value="200" :max="99" class="item">
                <el-menu-item index="4">测试计划</el-menu-item>
            </el-badge> -->
            <el-menu-item index="4">
                <div class="badge_custom">
                    122
                </div>
                <span>测试计划</span>
            </el-menu-item>
            <el-menu-item index="5">测试记录</el-menu-item>
        </el-menu>

        <div class="login_button_bg">
            <img width="20px" src="../assets/home/button_login.png" />
            &nbsp;&nbsp;&nbsp;&nbsp;
            <span>登录账号</span>
        </div>
        <!-- <div class="menu_gen">首页</div>
        <div class="menu_gen">科普乐园</div>
        <div class="menu_gen">留言社区</div>
        <div class="menu_gen">测试计划</div>
        <div class="menu_gen">测试记录</div>
        <div class="menu_gen">登录账号</div> -->
    </div>
</template>
<style lang="scss" scoped>
.badge_custom {
    position: absolute;
    background-color: #48D68E;
    left: 90px;
    top: 0px;

    line-height: 18px;
    color: 10px;
    padding: 0px 8px;
    font-weight: 300;
    font-size: 10px;
    color: #ffffff;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-bottom-right-radius: 20px;
}

//整个菜单底部样式
.el-menu--horizontal.el-menu {

    border-bottom: 0px solid var(--el-menu-border-color);
    display: flex;
    align-items: center;
}

.el-menu--horizontal>.el-menu-item {
    width: 120px;
    height: 40px;
    align-items: center;
    border-bottom: 0px solid transparent;
    color: var(--el-menu-text-color);
    display: inline-flex;
    // height: 100%;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    margin: 0;
}

.el-menu--horizontal .el-menu-item:not(.is-disabled):focus,
.el-menu--horizontal .el-menu-item:not(.is-disabled):hover {
    background-color: #48D68E;
    color: #000000 !important;
    border-radius: 12px;
}

//激活某个菜单时   底部样式
.el-menu--horizontal>.el-menu-item.is-active {
    border-bottom: 0px solid var(--el-menu-active-color);
    // color: var(--el-menu-active-color) !important;
    color: #000000 !important;
    background: #48D68E;
    border-radius: 12px;
    height: 40px;
    font-weight: 700;

}

.header_p {
    margin-top: 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;


    .header_image {
        // flex: 1
        margin-right: 100px;
    }

    .login_button_bg {
        background-color: #000000;
        border-radius: 12px;
        border: 3px solid #48D68E;
        color: #ffffff;
        padding: 8px 20px;
        cursor: pointer;
        display: flex;
        align-items: center;
    }

    .flex-grow {
        flex: 1;
    }

    .menu_gen {
        width: 80px;
        height: 20px;
        font-family: Alibaba PuHuiTi 2.0;
        font-weight: normal;
        font-size: 20px;
        color: #333333;
        line-height: 26px
    }
}
</style>
