el-upload删除时导致页面样式错乱!!

      <el-row class="head_image">
        <el-col :span="2" class="head_image_wrap">
          <el-upload
            class="upload"
            :class="{ hide: hideBusiness }"
            :action="getUploadUrl"
            :file-list="fileBusinessList"
            list-type="picture-card"
            :limit="1"
            accept="image/*"
            :on-success="handleBusinessSuccess"
            :on-error="handleBusinessError"
            :on-change="handleBusinessUpload"
            :on-preview="handleBusinessPreview"
            :on-remove="handleBusinessRemove"
            :before-upload="beforeAvatarUpload"
          >
            <img class="have_img" v-if="!getUserInfo.avatar" src="@/assets/imgs/head_image.png" alt />
          </el-upload>
        </el-col>
        <el-col class="head_image_name" :span="19">
          <p>
            <span class="first_span">姓名</span>
            <span v-if="type == '2'">{{ getUserInfo.realName || "/" }}</span>
            <span v-if="type == '5'">{{ getUserInfo.serviceName || "/" }}</span>
          </p>
          <p>
            <span class="first_span">手机号</span>
            <span>{{ getUserInfo.phoneMobile }}</span>
          </p>
        </el-col>
      </el-row>
      <el-row class="table_row">
        <el-col :span="8" class="password_img_wrap">
          <img src="@/assets/imgs/password.png" />
        </el-col>
        <el-col :span="16" class="password_edit">修改登录密码</el-col>
        <el-col :span="4" class="password_edit_button">
          <el-button @click="handleEdit('password')" v-if="getMenuBtn.includes('password')">修改密码</el-button>
        </el-col>
      </el-row>

上传的时候是好好的,结果一到删除,就变成这样了!气坏了我!太丑了呀!

这也导致页面太丑了吧!!
百思不得奇解,还以为是el-upload渐变的功能影响的,我就把它去掉了,F12发现是line-height影响了它。
把line-height改成和图片的一样高,结果还是没用!!
后面发现,原来是忘了给这个头像的父元素加上高度,导致line-height不能在同一水平上!
解决方法:
给父元素加上固定高度,或者直接继承父元素的高度100%!

    .head_image {
      height: 110px;
      margin-bottom: 90px;
      margin-top: 40px;
      .head_image_wrap {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;//就是这个高度没给到而导致的样式错乱!
        margin-right: 30px;
        .el-upload {
          width: 110px;
          height: 110px;
          .have_img {
            width: 100%;
            height: 100%;
          }
        }
      }
      .head_image_name {
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        // align-items: center;
        p {
          display: flex;

          .first_span {
            display: block;
            width: 50px;
            margin: 0 20px;
            text-align: right;
          }
        }
      }
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值