market-depth.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <view :class="['nums-item' , `nums-item_${type}`]" :style="{'height':height}">
  3. <text :class="['nums-item-bg', leftbg ? 'left' : 'right']" :style="{'width': val[2] + '%' }"></text>
  4. <view class="item-num">
  5. <text class="color">{{ val[0] }}</text>
  6. <text>{{ val[1] * 1000000 }}</text>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. name: "market-depth",
  13. props: {
  14. type: {
  15. type: Number,
  16. default: 0
  17. },
  18. val: {
  19. type: Array,
  20. default: () => {
  21. return []
  22. }
  23. },
  24. height: {
  25. type: String,
  26. default: ''
  27. },
  28. leftbg: {
  29. type: Boolean,
  30. default: false
  31. },
  32. },
  33. data() {
  34. return {
  35. };
  36. }
  37. }
  38. </script>
  39. <style lang="scss" scoped>
  40. .nums-item {
  41. width: 100%;
  42. position: relative;
  43. height: 40rpx;
  44. }
  45. .nums-item-bg {
  46. position: absolute;
  47. top: 0;
  48. z-index: 1;
  49. height: 100%;
  50. }
  51. .left {
  52. left: 0;
  53. }
  54. .right {
  55. right: 0;
  56. }
  57. .item-num {
  58. width: 100%;
  59. height: 100%;
  60. position: absolute;
  61. top: 0;
  62. right: 0;
  63. z-index: 2;
  64. display: flex;
  65. justify-content: space-between;
  66. align-items: center;
  67. font-size: 22rpx;
  68. font-family: PingFang SC, PingFang SC-Bold;
  69. font-weight: 700;
  70. line-height: 33rpx;
  71. color: #1a1a1a;
  72. text+text {
  73. font-weight: 700;
  74. line-height: 33rpx;
  75. }
  76. }
  77. .nums-item_1 {
  78. .nums-item-bg {
  79. background-color: $mai_04;
  80. }
  81. .color {
  82. color: $mai_02;
  83. }
  84. }
  85. .nums-item_2 {
  86. .nums-item-bg {
  87. background-color: $mai_03;
  88. }
  89. .color {
  90. color: $mai_01;
  91. }
  92. }
  93. </style>