美文网首页
vue上下标示时间线

vue上下标示时间线

作者: 猿分让我们相遇 | 来源:发表于2019-04-26 09:49 被阅读0次

效果


时间线.png

上下标示时间线(sb需求),保证时间线的标识,根据数据的长度定义宽度,超出为横向滚动条

<div class="zdy">
  <div :style="{width: forwidth +'px'}" class="secondbox">
    <div class="line firstline">无效</div>
    <div class="dib" style="margin-left: 100px">
      <div class="dib" v-for="(val,ind) in dayRuleData" :key="ind">
        <div class="dian"></div>
        <div class="line normalline">正常</div>
        <div class="dian"></div>
        <div class="line">
          <span v-if="(dayRuleData.length-1)!==ind">迟到</span>
          <span v-else>无效</span>
        </div>
        <div class="time-all">
          <span class="start-time">{{val.dayStartTime}}</span>
          <span class="end-time">{{val.dayEndTime}}</span>
          <div class="time-name">{{val.dayRuleName}}</div>
        </div>
      </div>
    </div>
  </div>
</div>
data(){
  return{
    forwidth:850,//默认宽度
    dayRuleData:[],
  }
},
methors:{
//获取后台数据
  getDayRuleList(){
        requestServices.dayRuleList({groupId:this.$route.query.groupId}).then((res) => {
          this.dayRuleData=res.resultData.datas;
          this.forwidth=this.dayRuleData.length*184+100;//根据数据的长度定义宽度
        })
      },
}
<style>
  .zdy{
    height: 66px;
    width: 95%;
    font-size: 11px;
    color: #C0C4CC;
    margin: 0 auto;
    overflow-x: auto;
    overflow-y:hidden ;
  }
  .dian{
    width: 12px;
    height: 12px;
    background-color: #409EFF;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    top: 10px;
  }
  .line{
    width: 100px;
    border-bottom: 2px solid #C0C4CC;
    color: #C0C4CC;
    font-size: 11px;
    text-align: center;
    display: inline-block;
  }
  .normalline{
    width: 50px;
    border-bottom: 2px solid #409EFF;
  }
  .time-all{
    margin-top: 10px;
  }
  .start-time{
    /*margin-left: 100px;*/
  }
  .end-time{
    margin-left: 30px;
  }
  .time-name{
    margin:8px 0 0 8px;
  }
  .firstline{
    position: absolute;
  }
  .secondbox{
    margin: auto;
  }
</style>

相关文章

  • vue上下标示时间线

    效果 上下标示时间线(sb需求),保证时间线的标识,根据数据的长度定义宽度,超出为横向滚动条

  • 2018-12-13

    vue的v-for嵌套可以多级引用,不同标示符就可以

  • js 执行上下文,作用域,变量内存管理

    js 执行上下文,作用域,变量内存管理 JS中变量的定义在内存中包括三个部分:* 变量标示(变量标示存储在内存的栈...

  • Vue 开发时间线

    Vue 开发日记第1天 安装开发环境 写登录页面 遇到的一些问题 Vue 开发日记第2天 登录跳转及路由 Vue ...

  • 12表示带

    标示带 标示带作用,事件都很类似标示线 动态添加标示带 动态删除标示带

  • Vue 如何去除路径中的#号

    在开发过程中发现路径中带有/#/的标示。 众所周知,vue-router有两种模式,hash模式和history模...

  • 5分钟通读vue源码架构

    下载 去github上下载Vue 运行起来 rollup + flow vue使用使用rollup打包,flow规...

  • Vue 去除路径中的#

    在开发过程中发现路径中带有/#/的标示,而且还去不掉,很丑陋。 众所周知,vue-router有两种模式,hash...

  • Vue | Vue-ls插件

    Vue插件,用于从Vue上下文中使用本地Storage,会话Storage和内存Storage 一个vue封装的本...

  • Vue的Vue-ls使用

    Vue插件,用于从Vue上下文中使用本地Storage,会话Storage和内存Storage 一个vue封装的本...

网友评论

      本文标题:vue上下标示时间线

      本文链接:https://www.haomeiwen.com/subject/zbnxnqtx.html