当前位置:   article > 正文

vue大屏项目基础模板,前端驾驶舱demo,完整代码分享_可视化大屏前端demo

可视化大屏前端demo

前端开发工作中,经常会遇到大屏展示项目,我每次开发大屏项目,都会基于这个模板来做,模版已经实现了基础布局,基础布局是按照flex自适应开发的,每个echarts图表也都做了自动适配。后期加上美工的图片 + 样式微调就搞定啦,如果追求快速开发,直接搬走妥妥够用。

下面直接上样式:(因为没有任何背景图 和 图片资源,加上样式就会好看很多)

大屏主页面代码:bigdata.vue

  1. <template>
  2. <div id="big-data-container" class="big-data-container">
  3. <div class="head">
  4. <h1>人力资源管理系统驾驶舱</h1>
  5. </div>
  6. <div class="data-container">
  7. <div class="data-left">
  8. <div class="data-left-item">
  9. <div class="title">各事业部工时</div>
  10. <div id="chart-left-1" style="height: calc(100% - 30px);"></div>
  11. <div class="data-foot-line"></div>
  12. </div>
  13. <div class="data-left-item">
  14. <div class="title">员工出勤情况</div>
  15. <div id="chart-left-3" style="height: calc(100% - 30px);"></div>
  16. <div class="data-foot-line"></div>
  17. </div>
  18. <div class="data-left-item">
  19. <div class="title">项目工时情况</div>
  20. <div id="chart-left-2" style="height: calc(100% - 30px);"></div>
  21. <div class="data-foot-line"></div>
  22. </div>
  23. </div>
  24. <div class="data-center">
  25. <!-- <div class="title">中间位置</div> -->
  26. <div class="center-top-num">
  27. <div class="item">
  28. <div class="text">集团员工人数</div>
  29. <div class="num">1,046</div>
  30. </div>
  31. <div class="item">
  32. <div class="text">正式员工人数</div>
  33. <div class="num">966</div>
  34. </div>
  35. <div class="item">
  36. <div class="text">实习员工人数</div>
  37. <div class="num">84</div>
  38. </div>
  39. <div class="data-foot-line"></div>
  40. </div>
  41. <div class="center-top">
  42. <div class="title">员工活跃信息</div>
  43. <iview-circle :size="200" style="padding: 8px 0;"></iview-circle>
  44. <div class="data-foot-line"></div>
  45. </div>
  46. <div class="title">出勤情况总计</div>
  47. <div id="chart-center" class="chart-center"></div>
  48. </div>
  49. <div class="data-right">
  50. <div class="data-right-item">
  51. <div class="title">考勤异常走势</div>
  52. <div id="chart-right-1" style="height: calc(100% - 30px);"></div>
  53. <div class="data-foot-line"></div>
  54. </div>
  55. <div class="data-right-item">
  56. <div class="title">员工打卡统计</div>
  57. <iview-circle></iview-circle>
  58. <div class="data-foot-line"></div>
  59. </div>
  60. <div class="data-right-item right-3">
  61. <div class="title">项目工时排行榜</div>
  62. <div id="chart-right-3" class="right-item">
  63. <div class="item">
  64. <div class="top">排名</div>
  65. <div class="pro-name">项目名称</div>
  66. <div class="num">工时</div>
  67. <div class="num">人数</div>
  68. </div>
  69. <div class="item">
  70. <div class="top top-1">
  71. <span>1</span>
  72. </div>
  73. <div class="pro-name">人员管理系统</div>
  74. <div class="num">679</div>
  75. <div class="num">8</div>
  76. </div>
  77. <div class="item">
  78. <div class="top top-2">
  79. <span>2</span>
  80. </div>
  81. <div class="pro-name">生产管理系统</div>
  82. <div class="num">1,700</div>
  83. <div class="num">6</div>
  84. </div>
  85. <div class="item">
  86. <div class="top top-3">
  87. <span>3</span>
  88. </div>
  89. <div class="pro-name">智慧园区管理系统</div>
  90. <div class="num">366</div>
  91. <div class="num">3</div>
  92. </div>
  93. </div>
  94. <div class="boxfoot"></div>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </template>
  100. <script>
  101. var echarts = require('echarts');
  102. import { chartLeft1, chartLeft2, chartLeft3, chartRight1 } from './bigdata/chart-options';
  103. import IviewCircle from './bigdata/IviewCircle';
  104. import './bigdata/layout.less';
  105. export default {
  106. components: {
  107. 'iview-circle': IviewCircle
  108. },
  109. data() {
  110. return {};
  111. },
  112. mounted() {
  113. var $chartLeft1 = echarts.init(document.getElementById('chart-left-1'));
  114. $chartLeft1.setOption(chartLeft1);
  115. var $chartLeft2 = echarts.init(document.getElementById('chart-left-2'));
  116. $chartLeft2.setOption(chartLeft2);
  117. var $chartLeft3 = echarts.init(document.getElementById('chart-left-3'));
  118. $chartLeft3.setOption(chartLeft3);
  119. var $chartCenter = echarts.init(document.getElementById('chart-center'));
  120. $chartCenter.setOption(chartRight1);
  121. var $chartRight1 = echarts.init(document.getElementById('chart-right-1'));
  122. $chartRight1.setOption(chartRight1);
  123. }
  124. };
  125. </script>
  126. <style scoped>
  127. /* .chart-center {
  128. display: flex;
  129. border: 1px solid #0000ff;
  130. height: 200px;
  131. flex-direction: column;
  132. margin-top: 20px;
  133. }
  134. .chart-center .item {
  135. text-align: center;
  136. border: 1px solid #00c1b3;
  137. flex: 1;
  138. } */
  139. .right-3 {
  140. display: flex;
  141. flex-direction: column;
  142. /* margin-top: 20px; */
  143. }
  144. .right-3 .right-item {
  145. flex: 1;
  146. display: flex;
  147. flex-direction: column;
  148. }
  149. .right-3 .item {
  150. text-align: left;
  151. border-bottom: 1px solid #549069;
  152. flex: 1;
  153. display: flex;
  154. padding: 5px 10px;
  155. margin: 0 10px;
  156. font-size: 14px;
  157. line-height: 30px;
  158. }
  159. .right-3 .item:last-child {
  160. border-bottom: 0;
  161. }
  162. .right-3 .item > div {
  163. color: white;
  164. }
  165. .right-3 .top {
  166. width: 60px;
  167. position: relative;
  168. }
  169. .right-3 .top span {
  170. position: absolute;
  171. width: 20px;
  172. line-height: 20px;
  173. top: 5px;
  174. text-align: center;
  175. border-radius: 5px;
  176. }
  177. .right-3 .top-1 span {
  178. background: #e80d0d;
  179. }
  180. .right-3 .top-2 span {
  181. background: #00c935;
  182. }
  183. .right-3 .top-3 span {
  184. background: #0083f4;
  185. }
  186. .right-3 .num {
  187. width: 88px;
  188. }
  189. .right-3 .pro-name {
  190. flex: 1;
  191. }
  192. </style>

各个关联文件:

chart-options.js

  1. var echarts = require("echarts");
  2. let chartLeft1 = {
  3. tooltip: {
  4. trigger: "axis",
  5. axisPointer: {
  6. type: "shadow"
  7. }
  8. },
  9. grid: {
  10. left: "0%",
  11. top: "10px",
  12. right: "0%",
  13. bottom: "4%",
  14. containLabel: true
  15. },
  16. xAxis: [
  17. {
  18. type: "category",
  19. data: [
  20. "第一事业部",
  21. "第二事业部",
  22. "第三事业部",
  23. "第四事业部",
  24. "第五事业部",
  25. "第七事业部"
  26. ],
  27. axisLine: {
  28. show: true,
  29. lineStyle: {
  30. color: "rgba(255,255,255,.1)",
  31. width: 1,
  32. type: "solid"
  33. }
  34. },
  35. axisTick: {
  36. show: false
  37. },
  38. axisLabel: {
  39. interval: 0,
  40. show: true,
  41. splitNumber: 15,
  42. textStyle: {
  43. color: "rgba(255,255,255,.6)",
  44. fontSize: "12"
  45. }
  46. }
  47. }
  48. ],
  49. yAxis: [
  50. {
  51. type: "value",
  52. axisLabel: {
  53. show: true,
  54. textStyle: {
  55. color: "rgba(255,255,255,.6)",
  56. fontSize: "12"
  57. }
  58. },
  59. axisTick: {
  60. show: false
  61. },
  62. axisLine: {
  63. show: true,
  64. lineStyle: {
  65. color: "rgba(255,255,255,.1 )",
  66. width: 1,
  67. type: "solid"
  68. }
  69. },
  70. splitLine: {
  71. lineStyle: {
  72. color: "rgba(255,255,255,.1)"
  73. }
  74. }
  75. }
  76. ],
  77. series: [
  78. {
  79. type: "bar",
  80. data: [200, 600, 300, 900, 1500, 1200, 600],
  81. barWidth: "35%",
  82. itemStyle: {
  83. normal: {
  84. color: "#2f89cf",
  85. opacity: 1,
  86. barBorderRadius: 5
  87. }
  88. }
  89. }
  90. ]
  91. };
  92. let chartLeft2 = {
  93. tooltip: {
  94. trigger: "axis",
  95. axisPointer: {
  96. type: "shadow"
  97. }
  98. },
  99. grid: {
  100. left: "0%",
  101. top: "10px",
  102. right: "0%",
  103. bottom: "4%",
  104. containLabel: true
  105. },
  106. xAxis: [
  107. {
  108. type: "category",
  109. data: [
  110. "07.01",
  111. "07.02",
  112. "07.03",
  113. "07.04",
  114. "07.05",
  115. "07.06",
  116. ],
  117. axisLine: {
  118. show: true,
  119. lineStyle: {
  120. color: "rgba(255,255,255,.1)",
  121. width: 1,
  122. type: "solid"
  123. }
  124. },
  125. axisTick: {
  126. show: false
  127. },
  128. axisLabel: {
  129. interval: 0,
  130. // rotate:50,
  131. show: true,
  132. splitNumber: 15,
  133. textStyle: {
  134. color: "rgba(255,255,255,.6)",
  135. fontSize: "12"
  136. }
  137. }
  138. }
  139. ],
  140. yAxis: [
  141. {
  142. type: "value",
  143. axisLabel: {
  144. show: true,
  145. textStyle: {
  146. color: "rgba(255,255,255,.6)",
  147. fontSize: "12"
  148. }
  149. },
  150. axisTick: {
  151. show: false
  152. },
  153. axisLine: {
  154. show: true,
  155. lineStyle: {
  156. color: "rgba(255,255,255,.1 )",
  157. width: 1,
  158. type: "solid"
  159. }
  160. },
  161. splitLine: {
  162. lineStyle: {
  163. color: "rgba(255,255,255,.1)"
  164. }
  165. }
  166. },
  167. {
  168. type: "value",
  169. axisLabel: {
  170. show: true,
  171. textStyle: {
  172. color: "rgba(255,255,255,.6)",
  173. fontSize: "12"
  174. }
  175. },
  176. axisTick: {
  177. show: false
  178. },
  179. axisLine: {
  180. show: true,
  181. lineStyle: {
  182. color: "rgba(255,255,255,.1 )",
  183. width: 1,
  184. type: "solid"
  185. }
  186. },
  187. splitLine: {
  188. lineStyle: {
  189. color: "rgba(255,255,255,.1)"
  190. }
  191. }
  192. }
  193. ], series: [
  194. {
  195. type: "bar",
  196. name: "销量",
  197. data: [1200, 800, 300, 500, 560, 220],
  198. barWidth: "25%",
  199. itemStyle: {
  200. normal: {
  201. color: "#2f89cf",
  202. opacity: 1,
  203. barBorderRadius: 5
  204. }
  205. }
  206. }, {
  207. type: "bar",
  208. name: "订单",
  209. data: [1000, 750, 380, 450, 450, 120],
  210. barWidth: "25%",
  211. itemStyle: {
  212. normal: {
  213. color: "#46d000",
  214. opacity: 1,
  215. barBorderRadius: 5
  216. }
  217. }
  218. }
  219. ]
  220. };
  221. let chartLeft3 = {
  222. tooltip: {
  223. trigger: 'axis',
  224. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  225. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  226. }
  227. },
  228. grid: {
  229. left: "0%",
  230. top: "-5px",
  231. right: "3%",
  232. bottom: "4%",
  233. containLabel: true
  234. },
  235. xAxis: {
  236. type: 'value',
  237. axisLabel: {
  238. show: true,
  239. textStyle: {
  240. color: "rgba(255,255,255,.6)",
  241. fontSize: "12"
  242. }
  243. },
  244. axisTick: {
  245. show: false
  246. },
  247. axisLine: {
  248. show: true,
  249. lineStyle: {
  250. color: "rgba(255,255,255,.1 )",
  251. width: 1,
  252. type: "solid"
  253. }
  254. },
  255. splitLine: {
  256. lineStyle: {
  257. color: "rgba(255,255,255,.1)"
  258. }
  259. }
  260. },
  261. yAxis: {
  262. type: 'category',
  263. axisLabel: {
  264. show: true,
  265. textStyle: {
  266. color: "rgba(255,255,255,.6)",
  267. fontSize: "12"
  268. }
  269. },
  270. axisTick: {
  271. show: false
  272. },
  273. axisLine: {
  274. show: true,
  275. lineStyle: {
  276. color: "rgba(255,255,255,.1 )",
  277. width: 1,
  278. type: "solid"
  279. }
  280. },
  281. splitLine: {
  282. lineStyle: {
  283. color: "rgba(255,255,255,.1)"
  284. }
  285. },
  286. data: ['周一', '周二', '周三', '周四', '周五']
  287. },
  288. series: [
  289. {
  290. name: '直接访问',
  291. type: 'bar',
  292. stack: '总量',
  293. label: {
  294. show: true,
  295. position: 'insideRight'
  296. },
  297. barWidth: "55%",
  298. itemStyle: {
  299. normal: {
  300. color: "#2f89cf",
  301. opacity: 1,
  302. barBorderRadius: 5
  303. }
  304. },
  305. data: [120, 302, 400, 200, 700]
  306. }
  307. ]
  308. };
  309. let chartRight1 = {
  310. title: {},
  311. tooltip: {
  312. trigger: "axis",
  313. axisPointer: {
  314. type: "cross",
  315. label: {
  316. backgroundColor: "#6a7985"
  317. }
  318. }
  319. },
  320. color: ["#ffab6f", "#09b916", "#83cddc"], //图例颜色
  321. legend: {
  322. top: "0%",
  323. icon: "roundRect",
  324. data: ["白班人数", "夜班人数", "考勤异常"],
  325. textStyle: {
  326. color: "rgba(255,255,255,.5)",
  327. fontSize: "12"
  328. }
  329. },
  330. toolbox: {
  331. feature: {}
  332. },
  333. grid: {
  334. left: "10",
  335. top: "20",
  336. right: "10",
  337. bottom: "10",
  338. containLabel: true
  339. },
  340. xAxis: [
  341. {
  342. type: "category",
  343. boundaryGap: false,
  344. axisLabel: {
  345. textStyle: {
  346. color: "rgba(255,255,255,.6)",
  347. fontSize: 12
  348. }
  349. },
  350. axisLine: {
  351. lineStyle: {
  352. color: "rgba(255,255,255,.2)"
  353. }
  354. },
  355. data: [
  356. "2020.06.15",
  357. "2020.06.16",
  358. "2020.06.17",
  359. "2020.06.18",
  360. "2020.06.19",
  361. "2020.06.20",
  362. "2020.06.21",
  363. "2020.06.22"
  364. ]
  365. }
  366. ],
  367. yAxis: [
  368. {
  369. type: "value",
  370. axisTick: { show: false },
  371. minInterval: 60,
  372. axisLine: {
  373. lineStyle: {
  374. color: "rgba(255,255,255,.1)"
  375. }
  376. },
  377. axisLabel: {
  378. textStyle: {
  379. color: "rgba(255,255,255,.6)",
  380. fontSize: 12
  381. }
  382. },
  383. splitLine: {
  384. lineStyle: {
  385. color: "rgba(255,255,255,.1)"
  386. }
  387. }
  388. }
  389. ],
  390. series: [
  391. {
  392. name: "白班人数",
  393. type: "line",
  394. smooth: true,
  395. lineStyle: {
  396. color: "#45d4ba",
  397. width: 1
  398. }, //线条的样式
  399. areaStyle: {
  400. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  401. {
  402. offset: 0,
  403. color: "#83cddc"
  404. },
  405. {
  406. offset: 1,
  407. color: "#bfdffbb5"
  408. }
  409. ])
  410. },
  411. data: [5, 22, 150, 54, 1, 230, 4, 1]
  412. },
  413. {
  414. name: "夜班人数",
  415. type: "line",
  416. smooth: true,
  417. lineStyle: {
  418. color: "#04a710",
  419. width: 1
  420. }, //
  421. areaStyle: {
  422. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  423. {
  424. offset: 0,
  425. color: "#0cbf22"
  426. },
  427. {
  428. offset: 1,
  429. color: "#b8f7d1b5"
  430. }
  431. ])
  432. },
  433. data: [10, 150, 1, 250, 20, 100, 10, 150]
  434. },
  435. {
  436. name: "考勤异常",
  437. type: "line",
  438. lineStyle: {
  439. color: "#0864c3",
  440. width: 1
  441. }, //线条的样式
  442. smooth: true,
  443. areaStyle: {
  444. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  445. {
  446. offset: 0,
  447. color: "#29d7ff"
  448. },
  449. {
  450. offset: 1,
  451. color: "#34ccef85"
  452. }
  453. ])
  454. },
  455. data: [100, 2, 260, 1, 200, 30, 101, 40]
  456. }
  457. ]
  458. };
  459. export { chartLeft1, chartLeft2,chartLeft3, chartRight1 }

layout.less

  1. .big-data-container {
  2. position: absolute;
  3. overflow: hidden;
  4. height: 100%;
  5. width: 100%;
  6. background-color: #1400a8;
  7. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25' viewBox='0 0 1200 800'%3E%3Cdefs%3E%3CradialGradient id='a' cx='0' cy='800' r='800' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%230e0077'/%3E%3Cstop offset='1' stop-color='%230e0077' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='b' cx='1200' cy='800' r='800' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%2314057c'/%3E%3Cstop offset='1' stop-color='%2314057c' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='c' cx='600' cy='0' r='600' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%230d0524'/%3E%3Cstop offset='1' stop-color='%230d0524' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='d' cx='600' cy='800' r='600' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%231400a8'/%3E%3Cstop offset='1' stop-color='%231400a8' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='e' cx='0' cy='0' r='800' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%23000000'/%3E%3Cstop offset='1' stop-color='%23000000' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='f' cx='1200' cy='0' r='800' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%23130733'/%3E%3Cstop offset='1' stop-color='%23130733' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Crect fill='url(%23a)' width='1200' height='800'/%3E%3Crect fill='url(%23b)' width='1200' height='800'/%3E%3Crect fill='url(%23c)' width='1200' height='800'/%3E%3Crect fill='url(%23d)' width='1200' height='800'/%3E%3Crect fill='url(%23e)' width='1200' height='800'/%3E%3Crect fill='url(%23f)' width='1200' height='800'/%3E%3C/svg%3E");
  8. background-attachment: fixed;
  9. background-size: cover;
  10. .head {
  11. height: 75px;
  12. /* height: 1.05rem; */
  13. background: url(./head_bg.png) no-repeat center center;
  14. background-size: 100% 100%;
  15. position: relative;
  16. z-index: 100;
  17. }
  18. }
  19. .head h1 {
  20. margin: 0;
  21. color: #fff;
  22. text-align: center;
  23. /* font-size: .4rem; */
  24. /* line-height: .8rem; */
  25. line-height: 71px;
  26. }
  27. .data-container {
  28. /* margin: 5px 15px;
  29. height:100%; */
  30. margin: 0px 15px;
  31. position: absolute;
  32. left: 0;
  33. right: 0;
  34. top: 76px;
  35. bottom: 0;
  36. }
  37. .data-container > div {
  38. float: left;
  39. /* border: 1px solid white; */
  40. height: 100%;
  41. }
  42. .data-center {
  43. padding: 0 0.9rem;
  44. width: 40%;
  45. display: flex;
  46. flex-direction: column;
  47. // .center-top{
  48. // height: 210px;
  49. // background: red;
  50. // }
  51. .chart-center{
  52. flex: 1;
  53. }
  54. }
  55. .chart-center{
  56. width: 100%;
  57. display: flex;
  58. // background: white;
  59. }
  60. .data-left,
  61. .data-right {
  62. width: 30%;
  63. display: flex;
  64. flex-direction: column;
  65. }
  66. .data-left-item,
  67. .data-right-item,.center-top,.center-top-num,.chart-center {
  68. border: 1px solid rgba(25, 186, 139, 0.17);
  69. padding: 0 0.2rem 0.4rem 0.15rem;
  70. background: rgba(255, 255, 255, 0.04);
  71. background-size: 100% auto;
  72. position: relative;
  73. margin-bottom: 0.15rem;
  74. z-index: 10;
  75. }
  76. .data-foot-line {
  77. position: absolute;
  78. bottom: 0;
  79. width: 100%;
  80. left: 0;
  81. }
  82. .data-foot-line:before,
  83. .data-foot-line:after {
  84. position: absolute;
  85. width: 10px;
  86. height:10px;
  87. content: "";
  88. border-bottom: 2px solid #02a6b5;
  89. bottom: 0;
  90. }
  91. .boxall:before,
  92. .data-foot-line:before {
  93. border-left: 2px solid #02a6b5;
  94. left: 0;
  95. }
  96. .boxall:after,
  97. .data-foot-line:after {
  98. border-right: 2px solid #02a6b5;
  99. right: 0;
  100. }
  101. .boxall:before,
  102. .boxall:after {
  103. position: absolute;
  104. width: 10px;
  105. height: 10px;
  106. content: "";
  107. border-top: 2px solid #02a6b5;
  108. top: 0;
  109. }
  110. .data-left-item:before,
  111. .data-right-item:before,
  112. .center-top-num:before,
  113. .center-top:before{
  114. border-left: 2px solid #02a6b5;
  115. left: 0;
  116. position: absolute;
  117. width: 10px;
  118. height:10px;
  119. content: "";
  120. border-top: 2px solid #02a6b5;
  121. top: 0;
  122. }
  123. .data-left-item:after,
  124. .data-right-item:after,
  125. .center-top-num:after,
  126. .center-top:after {
  127. border-right: 2px solid #02a6b5;
  128. right: 0;
  129. position: absolute;
  130. width: 10px;
  131. height: 10px;
  132. content: "";
  133. border-top: 2px solid #02a6b5;
  134. top: 0;
  135. }
  136. .data-left,
  137. .data-right {
  138. /* display: flex; */
  139. }
  140. .data-left > .data-left-item,
  141. .data-right > .data-right-item {
  142. flex: 1;
  143. margin-bottom: 0.9rem;
  144. }
  145. .data-center .title,
  146. .data-left > .data-left-item .title,
  147. .data-right > .data-right-item .title {
  148. /* font-size: .2rem; */
  149. font-size: 1rem;
  150. padding: 7px 0;
  151. color: #fff;
  152. text-align: center;
  153. /* line-height: .5rem; */
  154. }
  155. .data-center .chart-center{
  156. width: 100%;
  157. }
  158. .center-top-num{
  159. height: 80px;
  160. padding-top: 7px;
  161. margin-bottom: 0.8rem;
  162. display: flex;
  163. .item{
  164. flex: 1;
  165. text-align: center;
  166. }
  167. .text{
  168. color: #fcf0d8;
  169. font-size: 14px;
  170. }
  171. .num{
  172. font-size: 34px;
  173. font-family: -apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
  174. font-weight: bold;
  175. color: #67caca;
  176. }
  177. }

IviewCircle.vue

  1. <template>
  2. <div class="demo-Circle">
  3. <div style>
  4. <i-circle
  5. :size="size"
  6. :trail-width="4"
  7. :stroke-width="5"
  8. :percent="75"
  9. stroke-linecap="square"
  10. stroke-color="#43a3fb"
  11. >
  12. <div class="demo-Circle-custom">
  13. <h1>1500</h1>
  14. <p>昨日活跃用户数量</p>
  15. <span>
  16. 占比
  17. <i>{{1500/20000}}%</i>
  18. </span>
  19. </div>
  20. </i-circle>
  21. </div>
  22. <div style>
  23. <i-circle
  24. :size="size"
  25. :trail-width="4"
  26. :stroke-width="5"
  27. :percent="75"
  28. stroke-linecap="square"
  29. stroke-color="#43a3fb"
  30. >
  31. <div class="demo-Circle-custom">
  32. <h1>12000</h1>
  33. <p>上月活跃用户数量</p>
  34. <span>
  35. 占比
  36. <i>{{12000/150000}}%</i>
  37. </span>
  38. </div>
  39. </i-circle>
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. export default {
  45. props:{
  46. size:{
  47. type:Number,
  48. default:150
  49. }
  50. }
  51. }
  52. </script>
  53. <style scoped>
  54. .demo-Circle {
  55. display: flex;
  56. }
  57. .demo-Circle > div {
  58. flex: 1;
  59. text-align: center;
  60. }
  61. .demo-Circle > div:first-child{
  62. padding-left:10%;
  63. }
  64. .demo-Circle > div:last-child{
  65. padding-right:10%;
  66. }
  67. </style>
  68. <style lang="less" scoped>
  69. .demo-Circle-custom {
  70. & h1 {
  71. color:#ffffff;
  72. font-size: 28px;
  73. font-weight: normal;
  74. }
  75. & p {
  76. color: #ece8e8;
  77. font-size: 14px;
  78. margin: 10px 0 15px;
  79. }
  80. & span {
  81. display: block;
  82. padding-top: 15px;
  83. color: wheat;
  84. font-size: 14px;
  85. &:before {
  86. content: "";
  87. display: block;
  88. width: 50px;
  89. height: 1px;
  90. margin: 0 auto;
  91. background: #e0e3e6;
  92. position: relative;
  93. top: -15px;
  94. }
  95. }
  96. & span i {
  97. font-style: normal;
  98. color: white;
  99. }
  100. }
  101. </style>

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/代码探险家/article/detail/903920
推荐阅读
相关标签
  

闽ICP备14008679号