mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-11 11:56:46 +08:00
154 lines
3.4 KiB
Vue
154 lines
3.4 KiB
Vue
<template>
|
|
<div class="navTop">
|
|
<div class="navTopMain">
|
|
<img
|
|
style="width: 205px; height: 29px; margin-left: 37px; margin-top: 22px"
|
|
src="../assets/images/navtop/logo.png"
|
|
/>
|
|
<div class="navTopRight">
|
|
<div class="role">
|
|
<div>{{ selectRole }}</div>
|
|
<div class="roleArrow"></div>
|
|
<div class="roleItems">
|
|
<div
|
|
v-for="(value, index) in roleList"
|
|
:key="index"
|
|
class="roleItem"
|
|
@click="changeRole(value)"
|
|
>
|
|
{{ value.name }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="user">
|
|
<img
|
|
style="
|
|
width: 30px;
|
|
height: 31px;
|
|
margin-left: 8px;
|
|
border-radius: 15px;
|
|
margin-right: 10px;
|
|
"
|
|
src="../assets/images/img.jpg"
|
|
/>
|
|
<div>李玉冰</div>
|
|
</div>
|
|
<img
|
|
style="
|
|
width: 27px;
|
|
height: 26px;
|
|
margin: 27px 29px 0px 31px;
|
|
cursor: pointer;
|
|
"
|
|
src="../assets/images/navtop/signout.png"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import { reactive, toRefs } from "vue";
|
|
export default {
|
|
name: "NavTop",
|
|
setup() {
|
|
const state = reactive({
|
|
selectRole: "管理员",
|
|
roleList: [
|
|
{
|
|
id: 1,
|
|
name: "管理员",
|
|
},
|
|
{
|
|
id: 2,
|
|
name: "学员",
|
|
},
|
|
],
|
|
});
|
|
const changeRole = (value) => {
|
|
state.roleList.map((item) => {
|
|
if (value.name === item.name) {
|
|
state.selectRole = item.name;
|
|
}
|
|
});
|
|
};
|
|
return {
|
|
...toRefs(state),
|
|
changeRole,
|
|
};
|
|
},
|
|
};
|
|
</script>
|
|
<style scoped lang="scss">
|
|
.navTop {
|
|
width: 100%;
|
|
height: 80px;
|
|
// display: flex;
|
|
background-color: rgba(255, 255, 255, 1);
|
|
// box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.21);
|
|
.navTopMain {
|
|
width: 100%;
|
|
height: 80px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
background-color: rgba(255, 255, 255, 1);
|
|
.navTopRight {
|
|
display: flex;
|
|
}
|
|
.role {
|
|
display: flex;
|
|
align-items: center;
|
|
font-size: 16px;
|
|
font-weight: 400;
|
|
color: #333330;
|
|
line-height: 36px;
|
|
cursor: pointer;
|
|
position: relative;
|
|
.roleArrow {
|
|
width: 13px;
|
|
height: 7px;
|
|
margin-left: 8px;
|
|
background-image: url(../assets/images/navtop/down.png);
|
|
background-size: 100%;
|
|
}
|
|
.roleItems {
|
|
width: 109px;
|
|
height: 90px;
|
|
padding-top: 10px;
|
|
background: #ffffff;
|
|
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.21);
|
|
position: absolute;
|
|
top: 60px;
|
|
right: 0px;
|
|
text-align: center;
|
|
display: none;
|
|
z-index: 100;
|
|
}
|
|
.roleItem {
|
|
font-size: 14px;
|
|
font-weight: 400;
|
|
color: rgba(79, 81, 86, 1);
|
|
line-height: 36px;
|
|
}
|
|
.roleItem:hover {
|
|
color: #4ea6ff;
|
|
}
|
|
}
|
|
.role:hover .roleItems {
|
|
display: block;
|
|
}
|
|
.role:hover .roleArrow {
|
|
background-image: url(../assets/images/navtop/up.png);
|
|
}
|
|
.user {
|
|
margin-left: 37px;
|
|
display: flex;
|
|
align-items: center;
|
|
font-size: 14px;
|
|
font-weight: 400;
|
|
color: #b3bdc4;
|
|
line-height: 36px;
|
|
}
|
|
}
|
|
}
|
|
</style>
|