<template>
<div class="card-wrapper">
  <div class="card-title" :style="`color:${color}`">
    <img src="@/assets/images/card-header-dot.png"/>
    <p class="title">{{title}}</p>
    <m-count v-if="value" class="count" :value="value" />
    <span v-if="unit" class="unit">{{unit}}</span>
  </div>
  <div class="card-content">
    <slot />
  </div>
</div>
</template>

<script>
export default {
  name: 'Mode1',
  props: {
    title: {
      type: String,
      default: '标题',
    },
    color: {
      type: String,
    },
    value: {
      type: Number,
    },
    unit: {
      type: String,
    }
  },
}
</script>

<style lang="stylus" scoped>
.card-wrapper
  .card-title
    display flex
    font-size .13rem
    align-items center
    font-weight bold
    background-image url(../../../assets/images/card-header.png)
    background-size 60% .03rem
    background-position left bottom
    background-repeat no-repeat
    >img
      width .2rem
      height @width
      margin-left 1%
      margin-right 4%
    .count
      font-size .14rem
      color $color-yellow
      margin-left 20%
      margin-right .05rem
    .unit
      font-size .1rem
      color #999
  .card-content
    position relative
    padding .1rem 0
    >div
      width 100%
      height 100%
</style>
