<template>
<div class="card-wrapper">
  <div class="card-title" :style="`color:${color}`">
    <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 50% 100%
    background-repeat no-repeat
    padding-left .3rem
    .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>
