TrendPanel.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <div class="trend-panel-container">
  3. <StatisticsItem :title="label" :value="value"></StatisticsItem>
  4. <!-- <div class="trend-text">
  5. <span class="lable">较昨日{{ currentInfo.text }}:</span>
  6. <span class="percent-text" :style="{ color: currentInfo.color }">{{ percent }}</span>
  7. <img class="trend-icon" :src="currentInfo.icon" alt="" />
  8. </div> -->
  9. </div>
  10. </template>
  11. <script>
  12. import StatisticsItem from './StatisticsItem.vue'
  13. const up = { text: '上涨', color: '#E90808', icon: require('../../../assets/images/dashboard/up-icon.png') }
  14. const down = { text: '下跌', color: '#0BBD1D', icon: require('../../../assets/images/dashboard/down-icon.png') }
  15. export default {
  16. components: { StatisticsItem },
  17. props: {
  18. type: {
  19. type: String,
  20. default: 'up'
  21. },
  22. percent: {
  23. type: String,
  24. default: '0%'
  25. },
  26. label: {
  27. type: String,
  28. required: true
  29. },
  30. value: {
  31. type: [Number, String],
  32. required: true
  33. }
  34. },
  35. computed: {
  36. currentInfo() {
  37. return this.type === 'up' ? up : down
  38. }
  39. }
  40. }
  41. </script>
  42. <style lang="scss" scoped>
  43. @media (max-width: 1540px) {
  44. ::v-deep .title {
  45. font-size: 12px !important;
  46. }
  47. ::v-deep .value{
  48. font-size: 18px !important;
  49. }
  50. }
  51. @media (max-width: 1390px) {
  52. ::v-deep .title {
  53. font-size: 16px !important;
  54. }
  55. ::v-deep .value{
  56. font-size: 24px !important;
  57. }
  58. }
  59. .trend-panel-container {
  60. position: relative;
  61. background-color: #f7f8fa;
  62. flex: 1;
  63. padding: 24px;
  64. box-sizing: border-box;
  65. border-radius: 8px;
  66. cursor: pointer;
  67. transition: transform 350ms, border-radius 1s;
  68. &::after {
  69. position: absolute;
  70. content: '';
  71. display: block;
  72. .trend-text {
  73. color: #fff !important;
  74. }
  75. }
  76. &:hover {
  77. transform: translateY(-5px);
  78. border-radius: 20px;
  79. }
  80. .trend-text {
  81. display: flex;
  82. align-items: center;
  83. color: #3d3d3d;
  84. font-size: 12px;
  85. .lable {
  86. @media (max-width: 1669px) {
  87. display: none;
  88. }
  89. }
  90. .percent-text {
  91. margin: 0 7px;
  92. }
  93. .trend-icon {
  94. width: 14px;
  95. height: 8px;
  96. }
  97. }
  98. }
  99. </style>