card.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <div>
  3. <div class="leftInfo">
  4. <div class="leftInfo_title">{{ title }}</div>
  5. <div class="leftInfo_value">
  6. <!-- {{value}} -->
  7. <NumberScroll :value="value" :duration="2000" />
  8. </div>
  9. <div class="leftInfo_growth" :style="{ color: growthColors[upStatus + 1] }">
  10. <el-icon
  11. ><Top v-if="upStatus == 1" /><SemiSelect v-if="upStatus == 0" /><Bottom
  12. v-if="upStatus == -1"
  13. /></el-icon>
  14. {{ growth }}
  15. </div>
  16. </div>
  17. <div class="icon" :style="{ background: iconColor + '32' }">
  18. <el-icon>
  19. <component :is="iconName" :color="iconColor" />
  20. </el-icon>
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. import NumberScroll from '@/components/AppVue/numberScroll.vue'
  26. export default {
  27. name: "card",
  28. components: {
  29. NumberScroll
  30. },
  31. props: {
  32. title: {
  33. type: String,
  34. default: "",
  35. },
  36. value: {
  37. type: String,
  38. default: "0",
  39. },
  40. growth: {
  41. type: String,
  42. default: "",
  43. },
  44. iconColor: {
  45. type: String,
  46. default: "#CCCCCC",
  47. },
  48. iconName: {
  49. type: String,
  50. default: "WalletFilled",
  51. },
  52. upStatus: {
  53. type: Number,
  54. // -1 下降
  55. // 0 持平
  56. // 1 上升
  57. default: -1,
  58. },
  59. },
  60. data() {
  61. return {
  62. // 0 下降
  63. // 1 持平
  64. // 2 上升
  65. growthColors: ["#F56C6C", "#909399", "#67C23A"],
  66. };
  67. },
  68. };
  69. </script>
  70. <style lang="less" scoped>
  71. .leftInfo {
  72. display: flex;
  73. flex-direction: column;
  74. justify-content: center;
  75. align-items: flex-start;
  76. }
  77. .leftInfo_title {
  78. font-size: 12px;
  79. color: #909399;
  80. line-height: 20px;
  81. }
  82. .leftInfo_value {
  83. margin-top: 4px;
  84. font-size: 24px;
  85. font-weight: bold;
  86. line-height: 33px;
  87. }
  88. .leftInfo_growth {
  89. margin-top: 12px;
  90. font-size: 12px;
  91. line-height: 20px;
  92. font-weight: bold;
  93. }
  94. .icon {
  95. width: 40px;
  96. height: 40px;
  97. border-radius: 5px;
  98. background: #ccc;
  99. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  100. font-size: 20px;
  101. display: flex;
  102. justify-content: center;
  103. align-items: center;
  104. }
  105. </style>