经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » JS/JS库/框架 » Vue.js » 查看文章
vue实现横向时间轴
来源:jb51  时间:2022/2/28 8:51:07  对本文有异议

本文实例为大家分享了vue实现横向时间轴的具体代码,供大家参考,具体内容如下

1、效果图

2、代码实现 

html

  1. <template>
  2. ? <div class="timeaxis" >
  3. ? ? <div v-for="item in list" :key="item.index">
  4. ? ? ? <div class="box">
  5. ? ? ? ? <div class="item">
  6. ? ? ? ? ? <div class="left">{{item.warnname}}</div>
  7. ? ? ? ? ? <div class="center">{{item.condation}}</div>
  8. ? ? ? ? </div>
  9. ? ? ? ? <div class="circular"></div>
  10. ? ? ? ? <div class="item2">
  11. ? ? ? ? ? <div class="bottom">{{item.standard}}</div>
  12. ? ? ? ? </div>
  13. ? ? ? </div>
  14. ? ? </div>
  15. ? </div>
  16. </template>
  17. <script>
  18. export default {
  19. ? data(){
  20. ? ? return {
  21. ? ? ? ? //数据
  22. ? ? ? list:[
  23. ? ? ? ? {
  24. ? ? ? ? ? ? ? warnname: "一级预警",
  25. ? ? ? ? ? ? ? condation: "60",
  26. ? ? ? ? ? ? ? standard: 18,
  27. ? ? ? ? ? ? ? median: 5,
  28. ? ? ? ? ? ? },
  29. ? ? ? ? ? ? {
  30. ? ? ? ? ? ? ? warnname: "二级预警",
  31. ? ? ? ? ? ? ? condation: "30",
  32. ? ? ? ? ? ? ? standard: 15,
  33. ? ? ? ? ? ? ? median: 5,
  34. ? ? ? ? ? ? },
  35. ? ? ? ? ? ? {
  36. ? ? ? ? ? ? ? warnname: "三级预警",
  37. ? ? ? ? ? ? ? condation: "15",
  38. ? ? ? ? ? ? ? standard: 22,
  39. ? ? ? ? ? ? ? median: 5,
  40. ? ? ? ? ? ? },
  41. ? ? ? ]
  42. ? ? }
  43. ? }
  44. }
  45. </script>

css样式

  1. <style scoped lang='less'>
  2. .timeaxis{
  3. ? width: 800px;
  4. ? height: 200px;
  5. }
  6. .box{
  7. ? float: left;
  8. ? width: 180px;
  9. }
  10. .circular{
  11. ? border: 2px solid #67c23a;
  12. ? width: 10px;
  13. ? height: 10px;
  14. ? border-radius: 10px;
  15. ? background: white;
  16. ? margin: auto;
  17. ? margin-bottom: -4px;
  18. ? position: relative;
  19. ? top: -8px;
  20. ? left: 85px;
  21. }
  22. .item{
  23. ? border-bottom: 1px solid #409eff;
  24. ? position: relative;
  25. ? .left{
  26. ? ? position: absolute;
  27. ? ? left: 55px;
  28. ? ? top: -25px;
  29. ? }
  30. ? .center{
  31. ? ? position: absolute;
  32. ? ? left: 165px;
  33. ? ? top: -26px;
  34. ? }
  35. }
  36. .item2 {
  37. ? position: relative;
  38. ?
  39. ? .bottom{
  40. ? ? position: absolute;
  41. ? ? left: 75px;
  42. ? ? top: 0px;
  43. ? }
  44. }
  45. </style>

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持w3xue。

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号