<template>
  <div class="card-model" :style="{ backgroundColor: state.theme }" @click="onHandleViewDetails">
    <div class="f-14">
      <svg-icon :icon-class="state.icon" class="icon-box" />
      {{ state.title }}
    </div>
    <div class="f-count">{{ state.count }}</div>
    <!-- <div class="f-14">
      <span v-if="!state.isIncrease">
        较上月降低
        <span style="color: red">{{ state.increase || 0 }}</span>
        %
      </span>
      <span v-else>较上月增长 {{ state.increase || 0 }} %</span>

      <svg-icon v-if="!state.isIncrease" icon-class="down_arrow" />
      <svg-icon v-else icon-class="up_arrow" />
    </div> -->
  </div>
</template>

<script>
export default {
  props: {
    state: {
      type: Object,
      default: {}
    }
  },
  mounted() {
    // console.log('card-model', this.state)
  },

  methods: {
    onHandleViewDetails() {
      // console.log('查询二级页面', this.cardTitle)
      // 使用自定义事件 通知父组件打开二级页面
      // this.$emit('onOpenLevelTwoPages', this.cardTitle)
    }
  }
}
</script>

<style scoped lang="scss">
.card-model {
  width: 100%;
  height: 100%;
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  border-radius: 12px;
  color: #fff;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* 初始阴影 */
  transition: transform 0.3s ease; /* 添加过渡效果 */

  & div {
    width: 100%;
    // padding-left: 40px;
    transform: translateX(40px);
  }

  .f-14 {
    position: relative;
    font-size: 14px;
    letter-spacing: 1px;

    .icon-box {
      font-size: 18px;
      position: absolute;
      transform: translateX(-120%);
    }
  }

  .f-count {
    margin: 4px 0;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 2px;
  }
}

.card-model:hover {
  cursor: pointer;
  transform: scale(1.03);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2); /* 鼠标移入时更明显的阴影 */
}
</style>
