similarity.vue 1.54 KB
<template>
  <div class="sim-box">
    <div>
      <div class="sim-num" :style="{'color':simcolor}">{{sim}}%</div>
      <div class="sim-title" >相似度</div>
    </div>
    <div class="sim-pro">
      <div class="bg-behind"></div>
      <div class="bg-front" :style="{'height':sim + 'px'}">
        <div class="front-pro"></div>
        <div class="front-top"></div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props:['cid','sim'],
 data(){
  return{
    simcolor:'#ccc',
  }
 },
 methods:{
 },
 created(){
   if(this.sim > 30 && this.sim <= 50){
    this.simcolor = '#5dd8a2'
   } else if (this.sim > 50 && this.sim <= 70){
     this.simcolor = '#f8c8a4'
   } else if (this.sim > 70 && this.sim <= 100){
      this.simcolor = '#ff7c93'
   }
 }
}
</script>

<style lang="stylus" scoped>
.sim-box{
  background #fff
  position relative
}
.sim-pro{
  position relative
  height 100px
}
.sim-num{
  color #ff7c93
  font-size 16px
  font-weight 600
}
.sim-title{
  color #666666
  font-size 14px
}
.bg-behind{
  position absolute
  left 0
  right 0
  z-index 100
  height: 100px;
  width: 20px;
  margin 0 auto
  background: red;
  background url('../../assets/img/sim02.png')no-repeat
  background-size 100% 100%
}
.bg-front{
  position absolute
  left 0
  right 0
  z-index 101
  bottom 0
  width: 20px;
  height: 1000px;
  margin 0 auto
  overflow hidden
  .front-pro{
    position absolute
    bottom 0
    height: 100px;
    width: 20px;
    background url('../../assets/img/sim01.png')no-repeat
    background-size 100% 100%
  }
}
</style>>