GrowCard.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <div class="grow-card">
  3. <div class="grow-card-header">
  4. <div class="grow-card__info">
  5. <p class="grow-card__title">{{ info.title }}</p>
  6. <CountTo prefix="$" :startVal="1" :endVal="info.price" />
  7. </div>
  8. <img :src="info.icon" />
  9. </div>
  10. <div class="grow-card-footer" :class="{ 'is-up': info.up }">
  11. <Statistic :value="info.percent">
  12. <template #prefix> <img :src="info.up ? riseSvg : downSvg" /> </template>
  13. </Statistic>
  14. <span class="grow-card__mom">{{ info.mom }}</span>
  15. </div>
  16. </div>
  17. </template>
  18. <script lang="ts">
  19. import { defineComponent, PropType } from 'vue';
  20. import { Statistic } from 'ant-design-vue';
  21. import { CountTo } from '/@/components/CountTo/index';
  22. import riseSvg from '/@/assets/svg/dashboard/analysis-rise.svg';
  23. import downSvg from '/@/assets/svg/dashboard/analysis-down.svg';
  24. import { GrowCardItem } from '../types';
  25. export default defineComponent({
  26. components: { Statistic, CountTo },
  27. props: {
  28. info: {
  29. type: Object as PropType<GrowCardItem>,
  30. default: null,
  31. },
  32. },
  33. setup() {
  34. return {
  35. riseSvg,
  36. downSvg,
  37. };
  38. },
  39. });
  40. </script>
  41. <style lang="less">
  42. .grow-card {
  43. display: flex;
  44. width: calc(100% - 12px);
  45. height: 158px;
  46. padding: 16px 16px 12px 16px;
  47. // margin: 0 12px 12px 12px;
  48. cursor: pointer;
  49. background: @white;
  50. border-radius: 4px;
  51. box-shadow: 6px 6px 54px 0 rgba(0, 0, 0, 0.05);
  52. flex-direction: column;
  53. &:hover {
  54. box-shadow: 6px 6px 54px 0 rgba(0, 0, 0, 0.1);
  55. }
  56. &-header {
  57. display: flex;
  58. width: 100%;
  59. justify-content: space-between;
  60. }
  61. &__title {
  62. font-family: PingFangSC-Regular;
  63. font-size: 16px;
  64. letter-spacing: 0;
  65. color: @text-color-base;
  66. opacity: 0.7;
  67. }
  68. &__info {
  69. span {
  70. font-family: NeoSans;
  71. font-size: 26px;
  72. line-height: 38px;
  73. }
  74. }
  75. &-footer {
  76. display: flex;
  77. width: 100%;
  78. margin-top: 24px;
  79. align-items: center;
  80. .ant-statistic-content-value {
  81. color: @error-color;
  82. }
  83. .ant-statistic-content-prefix svg {
  84. width: 0.98rem !important;
  85. height: 0.98rem !important;
  86. }
  87. &.is-up {
  88. .ant-statistic-content-value {
  89. color: @success-color;
  90. }
  91. }
  92. }
  93. &__mom {
  94. display: inline-block;
  95. padding-left: 10px;
  96. font-family: PingFangSC-Regular;
  97. font-size: 12px;
  98. line-height: 22px;
  99. letter-spacing: 0;
  100. color: #606060;
  101. }
  102. }
  103. </style>