iview等级级别

最后效果:
在这里插入图片描述

代码:

   <div class="level" v-if="isShowLevel">
      <span>级别</span>
      <div class="rating">
        <span v-if="level == null" style="font-size: 12px;">暂无数据</span>
        <div class="level-icon" v-else v-for="(index) in 4" :key="index" :style="{ background: getColor(index) }"></div>
      </div>
    </div>
methods: {
    getColor (index) {
      if (index < this.level) {
        return '#64e3ff' 
      } else {
        return '#ffffff'
      }
    },
}
//屏幕分辨率适配版,长经验长经验
.level {
  width: 55%;
  position: absolute;
  left: 20px;
  bottom: 3px;
  display: flex;
  align-items: center;
  color: #fff;
  .rating {
    font-size: 14px;
    display: flex;
    width: 70%;
    .level-icon {
      width: 25%;
      height: 10px;
      background: #fff;
      border: 2px solid #84efff;
      border-radius: 15%;
      margin-left: 5px;
    }
  }
}
//初始版
.level {
  width: 210px;
  position: absolute;
  left: 20px;
  bottom: 3px;
  display: flex;
  align-items: center;
  color: #fff;
}
.rating {
  font-size: 14px;
  display: flex;
}
.level-icon {
  width: 30px;
  height: 10px;
  background: #fff;
  border: 2px solid #84efff;
  border-radius: 15%;
  margin-left: 5px;
}

lelve变量是数字

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值