修改elementUi的el-dropdown样式

效果图

![在这里插入图片描述](https://img-blog.csdnimg.cn/42d0b9d7b9ec432cb22334511daaeb21.png

<template>
  <div class="nav-wrap">
    <img src="@/assets/imgs/通知.png" alt="通知" class="notice">
    <div class="avatar-wrap">
      <img src="@/assets/imgs/默认头像.png" alt="默认头像">
    </div>
    <el-dropdown size="medium" trigger="click">
      <div class="dropdown">
        <div class="title">
          <div class="name">阿贝贝</div>
          <div class="text">北京市朝天区</div>
        </div>
        <div class="drop-wrap">
          <img src="@/assets/imgs/用户名下拉.png" alt="用户名下拉" class="drop">
        </div>
      </div>
      <el-dropdown-menu slot="dropdown" class="dropdown-menu">
        <el-dropdown-item class="df aic name-item" disabled>阿贝贝</el-dropdown-item>
        <el-dropdown-item class="pwd-item df aic jcsb">修改密码
          <img src="@/assets/imgs/下拉.png" alt=""></el-dropdown-item>
        <el-dropdown-item class="logout df aic">退出</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>
<script>
export default {
  name: "",
  data() {
    return {
    };
  }
}
</script>
<style lang="scss" scoped>
.nav-wrap {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: 60px;
  padding-right: 45px;

  .notice {
    width: 18px;
    height: 20px;
  }

  .avatar-wrap {
    width: 32px;
    height: 32px;
    background-image: linear-gradient(90deg, );
    border: solid 2px rgba(47, 71, 200, 0.06);
    border-radius: 50%;
    margin: 0 10px;
  }

}

.dropdown {
  display: flex;
  cursor: pointer;
  color: #409EFF;
  align-items: center;

  .title {
    .name {
      width: 42px;
      height: 20px;
      font-family: Source Han Sans SC;
      font-size: 14px;
      font-weight: normal;
      font-stretch: normal;
      line-height: 14px;
      letter-spacing: 0px;
      color: #171725;
    }

    .text {
      width: 145px;
      height: 18px;
      font-family: Source Han Sans SC;
      font-size: 12px;
      font-weight: normal;
      font-stretch: normal;
      line-height: 12px;
      letter-spacing: 0px;
      color: #92929d;
    }

  }

  .drop-wrap {
    width: 9px;
    height: 6px;

    .drop {}
  }

}

.dropdown-menu {
  padding: 50px 10px 10px 10px;
  box-sizing: border-box;
  position: relative;

  .name-item {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    color: white;
    font-size: 18px;
    height: 50px;
    background-color: #465a70;
    border-radius: 5px;
    padding-left: 28px;
  }

  .pwd-item {
    height: 30px;
    border-bottom: 1px solid #ebedef;
    margin-top: 5px;
    &:hover {
      color: #606266;
      background-color: #ebedef;
      border-radius: 3px;
    }
  }

  .logout {
    border-radius: 2px;
    height: 30px;
    border-bottom: 1px solid #ebedef;
    margin-top: 5px;
    &:hover {
      color: #606266;
      background-color: #ebedef;
      border-radius: 3px;
    }
  }
}
</style>
<style lang="scss">
.el-popper.dropdown-menu {
  // background-color: #465a70;
  border: none;
  width: 150px;

  .popper__arrow {
    left: 105px !important;//箭头位置

    &::after {
      //箭头颜色
      border-bottom-color: #465a70 !important;
    }
  }

}

.el-dropdown-menu--medium {
  padding: 0px;
}
</style>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值