card.vue 1.9 KB

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