GPT答: |
7i24.cn
|
<template>
<div class="header">
<el-menu :default-active="activeIndex" mode="horizontal" background-color="#545c64" text-color="#fff"
active-text-color="#ffd04b">
<el-menu-item index="/">
<i class="el-icon-house"></i>首页
</el-menu-item>
<el-submenu index="user">
<template #title>
{{ username }}<i class="el-icon-arrow-down el-icon--right"></i>
</template>
<el-menu-item index="/profile">个人资料</el-menu-item>
<el-menu-item index="/logout">退出登录</el-menu-item>
</el-submenu>
</el-menu>
</div>
</template>
<script lang='ts'>
import { defineComponent } from 'vue';
export default defineComponent({
name: 'Test',
data() {
return {
activeIndex: '/',
username: '用户名',
};
},
});
</script>
<style scoped lang='scss'>
.header {
height: 60px;
}
.el-submenu__title {
display: flex;
}
.el-submenu__title i {
margin-left: auto;
}
</style>
|