network.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div class="test">
  3. <view v-if="tips" class="text">{{ tips }}</view>
  4. <view class="box">
  5. <view class='item'><text v-if="num >= 10" /></view>
  6. <view class='item'><text v-if="num >= 20" /></view>
  7. <view class='item'><text v-if="num >= 30" /></view>
  8. <view class='item'><text v-if="num >= 40" /></view>
  9. <view class='item'><text v-if="num >= 50" /></view>
  10. <view class='item'><text v-if="num >= 60" /></view>
  11. <view class='item'><text v-if="num >= 70" /></view>
  12. <view class='item'><text v-if="num >= 80" /></view>
  13. <view class='item'><text v-if="num >= 90" /></view>
  14. <view class='item'><text v-if="num >= 100" /></view>
  15. </view>
  16. </div>
  17. </template>
  18. <script>
  19. export default {
  20. name: 'network',
  21. props: {
  22. num: {
  23. type: [String, Number],
  24. default: 0
  25. },
  26. tips: {
  27. type: String,
  28. }
  29. }
  30. }
  31. </script>
  32. <style lang="less" scoped>
  33. .test {
  34. position: absolute;
  35. display: flex;
  36. top: 10px;
  37. left: 14px;
  38. .text {
  39. color: #fff;
  40. font-size: 12px;
  41. margin-top: 4px;
  42. }
  43. .box {
  44. width: 40px;
  45. height: 20px;
  46. display: flex;
  47. justify-content: space-around;
  48. overflow: hidden;
  49. padding: 0;
  50. .item {
  51. width: 8%;
  52. border-radius: 2px;
  53. background: rgba(0, 0, 0, 0.5);
  54. position: relative;
  55. text {
  56. position: absolute;
  57. top: 0;
  58. left: 0;
  59. display: inline-block;
  60. width: 100%;
  61. height: 100%;
  62. background: limegreen;
  63. }
  64. &:nth-child(1) {
  65. height: 4px;
  66. margin-top: 18px;
  67. text {
  68. background: rgb(255, 0, 0);
  69. }
  70. }
  71. &:nth-child(2) {
  72. height: 6px;
  73. margin-top: 16px;
  74. text {
  75. background: rgb(255, 50, 0);
  76. }
  77. }
  78. &:nth-child(3) {
  79. height: 8px;
  80. margin-top: 14px;
  81. text {
  82. background: rgb(255, 90, 0);
  83. }
  84. }
  85. &:nth-child(4) {
  86. height: 10px;
  87. margin-top: 12px;
  88. text {
  89. background: rgb(255, 130, 0);
  90. }
  91. }
  92. &:nth-child(5) {
  93. height: 12px;
  94. margin-top: 10px;
  95. }
  96. &:nth-child(6) {
  97. height: 14px;
  98. margin-top: 8px;
  99. }
  100. &:nth-child(7) {
  101. height: 16px;
  102. margin-top: 6px;
  103. }
  104. &:nth-child(8) {
  105. height: 18px;
  106. margin-top: 4px;
  107. }
  108. &:nth-child(9) {
  109. height: 20px;
  110. margin-top: 2px;
  111. }
  112. &:nth-child(10) {
  113. height: 22px;
  114. margin-top: 0px;
  115. }
  116. }
  117. }
  118. }
  119. </style>