ChartCard.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <a-card :loading="loading" :body-style="{ padding: '20px 24px 8px' }" :bordered="false">
  3. <div class="chart-card-header">
  4. <div class="meta">
  5. <span class="chart-card-title">{{ title }}</span>
  6. <span class="chart-card-action">
  7. <slot name="action"></slot>
  8. </span>
  9. </div>
  10. <div class="total"
  11. ><span>{{ total }}</span></div
  12. >
  13. </div>
  14. <div class="chart-card-content">
  15. <div class="content-fix">
  16. <slot></slot>
  17. </div>
  18. </div>
  19. <div class="chart-card-footer">
  20. <div class="field">
  21. <slot name="footer"></slot>
  22. </div>
  23. </div>
  24. </a-card>
  25. </template>
  26. <script lang="ts" setup>
  27. defineProps({
  28. title: {
  29. type: String,
  30. default: '',
  31. },
  32. total: {
  33. type: [Number, String],
  34. default: '',
  35. },
  36. loading: {
  37. type: Boolean,
  38. default: false,
  39. },
  40. });
  41. </script>
  42. <style lang="less" scoped>
  43. .chart-card-header {
  44. position: relative;
  45. overflow: hidden;
  46. width: 100%;
  47. .meta {
  48. position: relative;
  49. overflow: hidden;
  50. width: 100%;
  51. color: rgba(0, 0, 0, 0.45);
  52. font-size: 14px;
  53. line-height: 22px;
  54. }
  55. }
  56. .chart-card-action {
  57. cursor: pointer;
  58. position: absolute;
  59. top: 0;
  60. right: 0;
  61. }
  62. .chart-card-footer {
  63. border-top: 1px solid #e8e8e8;
  64. padding-top: 9px;
  65. margin-top: 8px;
  66. > * {
  67. position: relative;
  68. }
  69. .field {
  70. white-space: nowrap;
  71. overflow: hidden;
  72. text-overflow: ellipsis;
  73. margin: 0;
  74. }
  75. }
  76. .chart-card-content {
  77. margin-bottom: 12px;
  78. position: relative;
  79. height: 46px;
  80. width: 100%;
  81. .content-fix {
  82. position: absolute;
  83. left: 0;
  84. bottom: 0;
  85. width: 100%;
  86. }
  87. }
  88. .total {
  89. overflow: hidden;
  90. text-overflow: ellipsis;
  91. word-break: break-all;
  92. white-space: nowrap;
  93. color: #000;
  94. margin-top: 4px;
  95. margin-bottom: 0;
  96. font-size: 30px;
  97. line-height: 38px;
  98. height: 38px;
  99. }
  100. </style>