vue 实现横向时间轴
效果:
<template><!--时间线--><div class="timeLine" style="overflow: hidden;"><div class="content"><p class="tit">{{timeLineList[timeIndex].year}}</p><p>{{timeLineList[timeIndex].info}}</p></div><div class="my_timeline_prev" @click="moveLeft"><img src="../../../static/images/case_detail_left.png" class="my_timeline_node"/><div class="my_timeline_item_line" style="margin-top: -18px;"></div><div class="my_timeline_item_content" style="color: rgba(0,0,0,0);">上</div></div><div class="ul_box"><ul class="my_timeline" ref="mytimeline" style="margin-left: 10px;"><li class="my_timeline_item" v-for="(item,index) in timeLineList" :key="index"><!--圈圈节点--><div class="my_timeline_node" :style = " {backgroundColor: item.bgcolor, width: item.size + 'px', height: item.size + 'px'}" @click="changeActive(index)" :class="{active: index == timeIndex}"></div><!--线--><div class="my_timeline_item_line"></div><!--标注--><div class="my_timeline_item_content" :style="{color: item.color, fontSize: item.fontsize + 'px'}">{{item.timestamp}}</div></li></ul></div><div class="my_timeline_next" @click="moveRight"><img src="../../../static/images/case_detail_right.png" class="my_timeline_node"/><div class="my_timeline_item_content" style="color: rgba(0,0,0,0);">下</div></div></div> </template><script> export default {name: 'timeLine',data() {return {timeIndex: 2,timeLineList: [{timestamp: '2012年',color: '#999',fontsize: 18,size: '28',bgcolor: '#e4e7ed',icon: 'el-iconprev',year: '2012',info: 'chengli'}, {timestamp: '2013年',color: '#999',fontsize: 18,size: '28',bgcolor: '#e4e7ed',year: '2013',info: '工作室更名为:西安拓美网络科技有限公司'}, {timestamp: '2014年',color: '#999',fontsize: 18,size: '28',bgcolor: '#e4e7ed',year: '2014',info: '工作室更名为:西安拓美网络科技有限公司'}, {timestamp: '2015年',color: '#999',fontsize: 18,year: '2015',size: '28',bgcolor: '#e4e7ed',info: '工作室更名为:西安拓美网络科技有限公司'}, {timestamp: '2016年',color: '#999',fontsize: 18,size: '28',year: '2016',bgcolor: '#e4e7ed',info: '工作室更名为:西安拓美网络科技有限公司'}, {timestamp: '2017年',color: '#999',fontsize: 18,size: '28',bgcolor: '#e4e7ed',year: '2017',info: '工作室更名为:西安拓美网络科技有限公司'}, {timestamp: '2018年',color: '#999',fontsize: 18,size: '28',bgcolor: '#e4e7ed',year: '2018',info: '工作室更名为:西安拓美网络科技有限公司'}, {timestamp: '2019年',color: '#999',fontsize: 18,year: '2019',bgcolor: '#e4e7ed',size: '28',info: '工作室更名为:西安拓美网络科技有限公司'}]}},methods: {changeActive(index) {this.timeIndex = index;},moveLeft() {let marginLeft = parseInt(this.$refs.mytimeline.style.marginLeft);let listNum = 0;if(marginLeft <= 10 && (marginLeft >= -650)){this.$refs.mytimeline.style.marginLeft = marginLeft - 220 + 'px';}},moveRight() {let marginLeft = parseInt(this.$refs.mytimeline.style.marginLeft);if(marginLeft < (-200)){this.$refs.mytimeline.style.marginLeft = marginLeft + 220 + 'px';}}} } </script><style scoped> .my_timeline_prev, .my_timeline_next {float: left;display: inline-block;background-color: #fff;cursor: pointer; } .my_timeline_prev {width: 200px;float: left; } .my_timeline_next {width: 34px;margin-left: -22px; } .ul_box {width: 900px;height: 60px;display: inline-block;float: left;margin-top: 2px;overflow: hidden; } .my_timeline_item {display: inline-block;width: 220px; } .my_timeline_node {box-sizing: border-box;border-radius: 50%;cursor: pointer; } .my_timeline_node.active {background-color: #fff !important;border: 6px solid #f68720; } .my_timeline_item_line {width: 100%;height: 10px;margin: -14px 0 0 28px;border-top: 2px solid #E4E7ED;border-left: none; } .my_timeline_item_content {margin: 10px 0 0 -10px; } </style>
转载于:https://www.cnblogs.com/duanzhenzhen/p/10937675.html
vue 实现横向时间轴相关推荐
- vue实现横向时间轴
最近项目需求,一个横向的时间轴,看了看elmentUi只有一个纵向的,干脆自己手撸一个 效果图如下: <div class="Timeline"><h2>操 ...
- CSS实现一个动态横向时间轴
CSS实现一个动态横向时间轴 先看效果 html <template><x-view class="stepFlex"><x-viewv-for=&q ...
- vue+canvas绘制时间轴
vue+canvas绘制时间轴 最近在研究canvas绘制时间轴,直接上代码,希望分享能给大家带来帮助,效果如下: 代码如下,可以拷贝到vue项目中直接预览 <template><d ...
- Vue,swipper手写横向时间轴
在一次需求中,UI交互用是关于时间轴,手写代码如下: HTML代码: HTML: <!-- 时间轴 --><div class="swiper-container" ...
- js用滚动条模拟横向时间轴
原理是通过设置时间轴盒子overflow-x: scroll;横向溢出的时候出现滚动条: (同理,制作纵向时间轴则设置overflow-y: scroll) 在时间轴盒子外层再包裹一个固定大小的div ...
- Vue.js 实现时间轴功能
GitHub 时间轴组件封装 Main.js <template><div class="timeline-main"><div class=&quo ...
- vue 发展历程时间轴动画_PPT时间轴如何做出创意感?海量素材免费分享,网友:收藏...
时间轴页面,是工作型PPT中常见的页面之一.个人述职或者公司介绍PPT中,使用时间轴,能够让观众更加清晰地了解公司的发展历程. 但是,很多人在制作时间轴页面时,往往是这样的效果: 只有几行字和一根线, ...
- android自定义横向时间轴,Android自定义时间轴的实现过程
本文讲述Android自定义时间轴的实现过程,供大家参考,具体内容如下 时间轴效果,实际上非常简单,就是listView中一个又一个的条目而已-.大家可以只关注一个条目. 首先展示一个条目的布局效果 ...
- vue实现物流时间轴效果
实现效果 html <ul class="time-axis" :class="{ 'is-done': item.state === 1 }" v-fo ...
最新文章
- 实现数据“一键脱敏”,Sharding Sphere帮你搞定
- 【玩转cocos2d-x之十五】关卡选择的设计
- 斐波那契查找(Fibonacci Search)和折半查找
- 阮一峰 《ECMAScript 6 入门》:let 和 const 命令
- 12 哈希表相关类——Live555源码阅读(一)基本组件类
- Ubuntu上安装Robomongo及添加到启动器
- 2017282110261-高级软件工程第二次作业
- Dynamics CRM 2013 installation
- startService和onBinderService混合开发音乐播放器
- 微信联合苹果探索iOS系统的暗黑模式;iPhone SE 2于3月31日发布;Kotlin 1.3.70发布 | 极客头条...
- 编译原理--中间代码生成(自己看)
- unity3d 资源打包加密 整理
- 富文本编辑器在Java中使用
- CentOS7目录配置
- 微信小程序-视频教程-链接地址
- keil删除工程_安装及卸载keil5
- 阿里云邮箱企业版使用 SSL 加密协议登录邮箱
- OpenGL导入3DS专题
- 2020年有寓意的领证日期_2020年领结婚证的好日子,2020年领证寓意好日子
- 如何“快准狠”的找到内存的问题