<template>
  <header>
    <div class="l-content">
      <el-button @click="handMenu" plain icon="el-icon-menu" size="mini"> </el-button>
      <!-- <h3 style="color:#fff ">首页</h3> -->
     
      <el-breadcrumb separator="/">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item> 
            <el-breadcrumb-item :to="{ path: $route.path }">{{$route.meta.title}}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="r-content">
      <el-dropdown trigger="click" szie="mini">
        <span>
          <img :src="userImg" class="user" />
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item>个人中心</el-dropdown-item>
          <el-dropdown-item @click.native="loginOut">退出</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </header>
</template>
<script>
export default {
  name: "CommonHeader",
  data() {
    return {
      userImg: ("https://img2.baidu.com/it/u=2709280419,1891083158&fm=253&fmt=auto&app=138&f=JPG?w=500&h=889"),
    };
  },
  methods: {
    handMenu() {
      // this.$store.commit('collapseMenu')
      if (localStorage.getItem("isCollapse") == "true") {
        localStorage.setItem("isCollapse", false);
        this.$bus.$emit('brotherEvent',false)
      } else {
         this.$bus.$emit('brotherEvent',true)
        localStorage.setItem("isCollapse", true);
      }
      console.log(localStorage.getItem("isCollapse"));
      
    },
    loginOut() {
      this.$store.commit("clearToken");
      this.$store.commit("clearMenu");
      this.$router.push("/login");
    },
  },
  computed: {},
};
</script>
<style lang="less" scoped>
header {
  display: flex;
  height: 100%;
  justify-content: space-between;
  align-items: center;
}
.l-content {
  display: flex;
  align-content: center;
  .el-button {
    margin-right: 20px;
  }
}
.r-content {
  .user {
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }
}
</style>

后台管理系统的头文件：基本东西都写死了