From e483dc300c6d71d761ebe26a00528375b39cf82e Mon Sep 17 00:00:00 2001
From: “dzb” <2632970487@qq.com>
Date: 星期二, 20 九月 2022 12:30:12 +0800
Subject: [PATCH] 解决数据渲染问题
---
src/views/layout/components/Header/index.vue | 164 +++++++++---------------------------------------------
1 files changed, 29 insertions(+), 135 deletions(-)
diff --git a/src/views/layout/components/Header/index.vue b/src/views/layout/components/Header/index.vue
index c2255db..04cfe32 100644
--- a/src/views/layout/components/Header/index.vue
+++ b/src/views/layout/components/Header/index.vue
@@ -1,182 +1,76 @@
<template>
- <div>
- <!-- 澶撮儴 -->
- <el-header>
- <!-- 宸︿晶鑿滃崟 -->
- <div class="menuLeft">
- <div class="icon">
- <img style="width:30px;height:30px"
- src="https://axure-file.lanhuapp.com/90466432-c999-4bf0-80b8-ee3f96a2099e__155eeb2ceaac89ec717869a050964a36.svg"
- alt="">
- </div>
- <div class="systemName">閬傛槍鏅烘収鎵ф硶骞冲彴</div>
- <ul class="headerNav">
- <li v-for="(item,index) in nav" :key="item.name" :class="item.checked?'activeIndex':''" @click="handleChange(index)">{{item.name}}</li>
- </ul>
- </div>
+ <!-- 澶撮儴 -->
+ <el-header>
<!-- 鍙充晶鑿滃崟 -->
- <div class="menuRight">
- <div class="search">
- <el-input placeholder="璇疯緭鍏ユ悳绱㈠唴瀹�" suffix-icon="el-icon-search" v-model="search">
- </el-input>
+ <div class="header-title">
+ <div class="bell">
+ <el-icon class="el-icon-bell" style="color: white"></el-icon>
</div>
- <div class="userinfo userItem">
- <div class="userIcon"></div>
- <span class="username">admin<i class="el-icon-arrow-down" style="margin-left:3px"></i></span>
+ <div class="userinfo">
+ <div class="avatar"></div>
+ <span class="username">admin</span>
</div>
- <div class="userMessage userBtn"><i class="el-icon-message-solid"></i></div>
- <div class="userSetting userBtn"><i class="el-icon-s-tools"></i></div>
- <div class="userLoginout userBtn" @click="loginout"><i class="el-icon-switch-button"></i></div>
+ <div class="loginout" @click="loginout">閫�鍑虹櫥褰�</div>
</div>
</el-header>
- </div>
</template>
<script>
-import hamburger from "@/components/hamburger";
export default {
data() {
return {
opened: false,
- search:'',
- nav:[
- {
- name:'椹鹃┒鑸�',
- checked:true,
- },
- {
- name:'瑙嗛鏌ヨ',
- checked:false,
- },
- {
- name:'鎵ф硶绠$悊',
- checked:false,
- }
- ]
};
},
- components: {
- hamburger,
- },
- methods: {
- loginout() {
- // 娓呴櫎token
- localStorage.clear();
- this.$router.push({ path: "/login" });
- },
- handleChange(idx){
- // 璁剧疆nav婵�娲�
- this.nav.forEach((item,index)=>{
- index==idx?item.checked = true:item.checked = false;
- })
- localStorage.setItem('navIdx',idx);
+ methods:{
+ loginout(){
+ this.$router.push({path:"/login"})
}
- },
- mounted() {
- const idx = localStorage.getItem("navIdx");
- if(idx){
- this.handleChange(idx);
- }
- },
+ }
};
</script>
-<style lang="scss" scoped>
-* {
- margin: 0;
- padding: 0;
-}
-
+<style lang="scss" >
.el-header {
- background-color: rgb(0, 121, 254);
+ background-color: #071a38;
color: #333;
text-align: center;
line-height: 60px;
display: flex;
align-items: center;
- justify-content: space-between;
+ justify-content: flex-end;
padding: 0;
- position: fixed;
width: 100%;
- top: 0px;
- z-index: 9999;
- .menuLeft {
- color: #fff;
-
- .icon {
- margin: 0 20px;
- }
-
- .systemName {
- width: 185px;
- font-weight: 650;
- font-size: 18px;
- }
-
- ul,
- .icon {
- display: flex;
- align-items: center;
- }
-
- li {
- list-style: none;
- width: 100px;
- &:hover{
- cursor: pointer;
- }
- }
-
- .activeIndex {
- height: 30px;
- line-height: 30px;
- border-radius: 20px;
- background-color: #53a5ff;
- }
-
- display: flex;
- }
-
- .menuRight {
+ .header-title {
display: flex;
align-items: center;
+ width: 280px;
justify-content: space-evenly;
- .search{
- .el-input{
- width: 200px;
- margin: 0 10px;
- }
- .el-input__inner{
- height: 30px;
- }
- }
- .userItem{
- width: 120px;
- }
- .userBtn{
- width: 60px;
- color: #fff;
- font-size: 20px;
+ .bell {
+ background-color: #00d1fa;
+ width: 25px;
+ height: 25px;
+ border-radius: 5px;
+ text-align: center;
+ line-height: 25px;
}
.userinfo {
+ width: 100xp;
display: flex;
align-items: center;
- justify-content: center;
- .userIcon {
- width: 20px;
- height: 20px;
+ .avatar {
+ width: 25px;
+ height: 25px;
border-radius: 50%;
background-image: url("@/assets/imgs/user/default-avatar.jpg");
background-size: cover;
}
-
.username {
margin: 0 5px;
color: #22d3eb;
font-size: 14px;
}
}
-
.loginout {
color: #22d3eb;
font-size: 14px;
--
Gitblit v1.8.0