Newer
Older
iris_temperature_front_gz / src / components / BigData / Card / index.vue
<template>
  <el-card :body-style="{ padding: '0px' }" shadow="always">
    <div class="card-panel" >
      <div :style="backgroundColor" class="card-panel-icon-wrapper">
        <svg-icon :icon-class="icon" class-name="card-panel-icon" />
      </div>
      <div class="card-panel-description">
        <div class="card-panel-text">
          {{ title }}
        </div>
        <div class="card-panel-num" >
          {{ context }}
        </div>
      </div>
    </div>
  </el-card>
</template>

<script>
export default {
  name: 'Card',
  props: {
    title: {
      type: String,
      default: '标题'
    },
    subtitle: {
      type: String,
      default: ''
    },
    icon: {
      type: String,
      default: ''
    },
    context: {
      type: [String, Number],
      default: ''
    },
    color: {
      type: String,
      default: '#40c9c6'
    }
  },
  computed: {
    backgroundColor() {
      return {
        color: this.color
      }
    }
  }
}
</script>

<style lang="scss" scoped>
  .card-panel {
    height: 80px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #ffffff;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);

  &:hover {
    .card-panel-icon-wrapper {
      color: #ffffff;
    }
  }

  .card-panel-icon-wrapper {
    float: left;
    margin: 3px 0 0 14px;
    padding: 16px;
    transition: all 0.38s ease-out;
    border-radius: 6px;
  }

  .card-panel-icon {
    float: left;
    font-size: 48px;
  }

  .card-panel-description {
    float: left;
    font-weight: bold;
    margin: 16px;
    margin-left: 10px;

  .card-panel-text {
    line-height: 18px;
    color: rgba(0, 0, 0, 0.45);
    font-size: 16px;
    margin-bottom: 12px;
  }

  .card-panel-num {
    font-size: 20px;
    color: rgba(0, 0, 0, 0.45);
  }
  }
  }
</style>