1
0

ChartCard.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <a-card :loading="loading" :body-style="{ padding: '20px 24px 8px' }" :bordered="false">
  3. <div class="chart-card-header">
  4. <a-statistic :title="title" :precision="precision" :value="total" />
  5. </div>
  6. <div class="chart-card-content">
  7. <div class="content-fix">
  8. <slot></slot>
  9. </div>
  10. </div>
  11. <div class="chart-card-footer">
  12. <div class="field">
  13. <slot name="footer"></slot>
  14. </div>
  15. </div>
  16. </a-card>
  17. </template>
  18. <script>
  19. export default {
  20. name: 'ChartCard',
  21. props: {
  22. title: {
  23. type: String,
  24. default: ''
  25. },
  26. total: {
  27. type: [Function, Number, String],
  28. required: false,
  29. default: null
  30. },
  31. loading: {
  32. type: Boolean,
  33. default: false
  34. },
  35. precision: {
  36. type: Number,
  37. default: 0
  38. }
  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, .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>