tab1.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <div>
  3. <a-row
  4. class="container status-number"
  5. type="flex"
  6. justify="center"
  7. align="middle"
  8. >
  9. <a-col :span="6">
  10. <div class="status-item">
  11. <span class="label">带看房间</span>
  12. <!-- <span class="number">80</span> -->
  13. <vue3-autocounter
  14. ref="counter"
  15. class="number"
  16. :startAmount="0"
  17. :endAmount="2021"
  18. :duration="2"
  19. separator=","
  20. decimalSeparator="."
  21. :decimals="0"
  22. :autoinit="true"
  23. />
  24. </div>
  25. </a-col>
  26. <a-col :span="6">
  27. <div class="status-item">
  28. <span class="label">访问总人数</span>
  29. <vue3-autocounter
  30. ref="counter"
  31. class="number"
  32. :startAmount="0"
  33. :endAmount="11122"
  34. :duration="2"
  35. separator=","
  36. decimalSeparator="."
  37. :decimals="0"
  38. :autoinit="true"
  39. />
  40. </div>
  41. </a-col>
  42. <a-col :span="6">
  43. <div class="status-item">
  44. <span class="label">访问总次数</span>
  45. <vue3-autocounter
  46. ref="counter"
  47. class="number"
  48. :startAmount="0"
  49. :endAmount="222225"
  50. :duration="2"
  51. separator=","
  52. decimalSeparator="."
  53. :decimals="0"
  54. :autoinit="true"
  55. />
  56. </div>
  57. </a-col>
  58. <a-col :span="6">
  59. <div class="status-item">
  60. <span class="label">访问总次数</span>
  61. <vue3-autocounter
  62. ref="counter"
  63. class="number"
  64. :startAmount="0"
  65. :endAmount="222225"
  66. :duration="2"
  67. separator=","
  68. decimalSeparator="."
  69. :decimals="0"
  70. :autoinit="true"
  71. />
  72. </div>
  73. </a-col>
  74. </a-row>
  75. <a-row>
  76. <div class="container">
  77. <div id="chart-1" class="chart"></div>
  78. </div>
  79. </a-row>
  80. </div>
  81. </template>
  82. <script lang="ts" setup>
  83. import { computed, onMounted } from 'vue'
  84. import Vue3Autocounter from 'vue3-autocounter'
  85. import * as echarts from 'echarts'
  86. import type { ECharts } from 'echarts'
  87. onMounted(() => {
  88. const chart1 = document.getElementById('chart-1')
  89. let myChart: ECharts
  90. if (chart1) {
  91. myChart = echarts.init(chart1)
  92. // 绘制图表
  93. myChart.setOption({
  94. title: { text: '总用户量' },
  95. tooltip: {},
  96. xAxis: {
  97. data: ['12-3', '12-4', '12-5', '12-6', '12-7', '12-8']
  98. },
  99. yAxis: {},
  100. series: [
  101. {
  102. name: '用户量',
  103. type: 'line',
  104. data: [5, 20, 36, 10, 10, 20]
  105. }
  106. ]
  107. })
  108. }
  109. window.onresize = function () {
  110. //自适应大小
  111. myChart.resize()
  112. }
  113. })
  114. </script>
  115. <style lang="less">
  116. .status-number {
  117. .status-item {
  118. display: flex;
  119. flex-direction: column;
  120. justify-content: center;
  121. align-items: center;
  122. .label {
  123. font-size: 14px;
  124. font-weight: 400;
  125. color: #969799;
  126. line-height: 16px;
  127. }
  128. .number {
  129. font-size: 24px;
  130. font-weight: bold;
  131. color: #323233;
  132. line-height: 28px;
  133. }
  134. }
  135. }
  136. .container {
  137. background-color: #fff;
  138. padding: 25px;
  139. width: 100%;
  140. margin-bottom: 25px;
  141. }
  142. .chart {
  143. width: 100%;
  144. min-height: 500px;
  145. }
  146. </style>