vue 实现拐弯时间线,弯曲时间线,弯曲任务步骤条

需求:

实现可拐弯的步骤条功能

实现后效果如下:

在这里插入图片描述

代码部分:

  1. 创建步骤条组件Steps.vue
<template><div><divstyle="width: 100%; display: flex; position: relative; margin-top: 20px"><div style="width: 2%; margin-left: 30px"><div><spandata-v-jzl20210826=""style="margin-top: 35px; opacity: 0"class="headerRadio"></span><div v-if="experienceData.length > Index"><spanv-for="(num, index) in leftRows":key="index"class="hingelisHeard"style="margin-top: 55px"></span></div><spandata-v-jzl20210826=""v-if="leftShow"style="margin-top: 98.5px; opacity: 0"class="hingeorgerHeard"></span></div></div><div style="width: 96%"><divstyle="display: flex"v-for="(item, index) in experienceData":key="index"><div style="display: flex; width: 100%" v-if="(index + 1) % 2 != 0"><divclass="timeline"v-for="(v, i) in DisplayProcessing(experienceData, index + 1)":key="i":style="(i + 1) % Index != 0 ? '' : 'width: 12%;'"><div class="Nodes"><SvgIcon name="ele-Microphone" :size="20" style="color: #f56c6c" /></div><div class="timeNodes"><div class="nodeTimes"><span>{{ v.createTime }} </span></div><div class="timeContent"><el-tooltipclass="item"effect="dark":content="v.content"placement="right"><pclass="nodeTimelis"@click="onClickDate(v.createTime, term)"><span v-if="v.status === 0" style="color: #409eff">{{ v.content }}</span><span v-else-if="v.status === 1" style="color: #42a51a">{{ v.content }}</span><span v-else style="color: #6b7280c2">{{ v.content }}</span></p></el-tooltip></div></div><divclass="border"v-if="(i + 1) % Index != 0 &&i != DisplayProcessing(experienceData, index + 1).length - 1"><div class="borderTime"></div></div></div></div><div style="display: flex; width: 100%" v-else><divclass="timeline2"v-for="(v, i) in DisplayProcessing(experienceData, index + 1)":key="i":style="i + 1 == 1 &&DisplayProcessing(experienceData, index + 1).length != 1? 'width: 12%;': ''"><div class="border" v-if="i != 0"><div class="borderTime"></div></div><div class="Nodes"><SvgIcon name="ele-Microphone" :size="20" style="color: #f56c6c" /></div><div class="timeNodes"><div class="nodeTimes"><span>{{ v.createTime }} </span></div><div class="timeContent"><el-tooltipclass="item"effect="dark":content="v.content"placement="right"><pclass="nodeTimelis"@click="onClickDate(v.createTime, term)"><span v-if="v.status === 0" style="color: #409eff">{{ v.content }}</span><span v-else-if="v.status === 1" style="color: #42a51a">{{ v.content }}</span><span v-else style="color: #6b7280c2">{{ v.content }}</span></p></el-tooltip></div></div></div></div></div></div><div style="width: 2%; margin-right: 30px"><div><span class="hingelis" v-if="experienceData.length > Index"></span><div v-if="experienceData.length > Index * 2"><spanclass="hingelis"v-for="(num, index) in rightRows":key="index"style="margin-top: 60px"></span></div></div></div></div></div>
</template>
<script>
export default {props: {data: {type: Array,default: () => {return [];},},Index: {type: Number,default: 0,}, //第一行展示X条数据},data() {return {experienceData: this.data,leftRows: 0,rightRows: 0,leftShow: false,rightShow: false,// pdfImg: require("../../assets/images/pdfReported.png"), //在下方展示的图片};},watch: {data: {handler(newVal, oldVal) {//时间线数据this.experienceData = newVal;let rows = Math.ceil(newVal.length / this.Index);this.leftRows =rows == 2? 0: rows % 2 == 0? parseInt(rows / 2) - 1: parseInt(rows / 2);this.rightRows =rows == 4? 1: rows % 2 == 0? parseInt(rows / 2) % 2 == 0? parseInt(rows / 2) >= 4? parseInt(rows / 2) - 1: parseInt(rows / 2): parseInt(rows / 2) - 1: parseInt(rows / 2) - 1;this.leftShow = rows % 2 == 0 ? true : false;this.rightShow = rows == 1 ? false : rows % 2 == 1 ? true : false;},immediate: true,},},created() {},methods: {DisplayProcessing(Arg, Num) {//数据循环处理let arr = Arg.slice(this.Index * (Num - 1), this.Index * Num);arr = Num % 2 == 0 ? arr.reverse() : arr;return arr;},onClickDate(date, term) {//选择报告this.$emit("onClickDate", term);},},
};
</script>
<style scoped lang="scss">
.timeline {width: 100%;height: 60px;display: flex;align-items: center;
}
.timeline2 {width: 100%;height: 60px;display: flex;align-items: center;justify-content: flex-end;
}
.border {width: 100%;justify-content: center;align-items: center;display: flex;.borderTime {border-bottom: 2px solid #9cd3ff;width: 100%;}
}.Nodes {svg {// background: ;color: #1e9bff;height: 1.5em;width: 1.5em;}
}.timeNodes {display: flex;flex-wrap: wrap;align-items: center;max-width: 135px;
}.nodeTimelis {max-width: 150px;overflow: hidden;word-break: keep-all;white-space: nowrap;text-overflow: ellipsis;cursor: pointer;
}
.nodeTimelis:active {color: #1e9bff;
}
.nodeTimes {margin-bottom: 0;
}.btns-img {height: 16px;width: 16px;
}.hingelis {content: "";display: block;width: 100%;height: 60px;border: 2px solid #9cd3ff;border-radius: 0 20px 20px 0px;border-left: 0px;margin-top: 29.5px;
}.hingelisHeard {content: "";display: block;width: 100%;height: 63.1px;border: 2px solid #9cd3ff;border-radius: 20px 0px 0px 20px;border-right: 0px;margin-top: 50px;
}.hingeorger {display: block;width: 100%;border-bottom: 1px solid #cccccc;margin: 49.5px 0;position: relative;
}
.hingeorgerHeard {display: block;width: 100%;border-bottom: 1px solid #cccccc;position: relative;
}.hingeorgerHeard[data-v-jzl20210826]:after {content: "";position: absolute;top: -4px;left: -2px;border-top: 5px solid transparent;border-right: 12px solid #cccccc;border-bottom: 5px solid transparent;
}.hingeorger[data-v-jzl20210826]:after {content: "";position: absolute;top: -4px;right: -2px;border-top: 5px solid transparent;border-left: 12px solid #cccccc;border-bottom: 5px solid transparent;
}.headerRadio {display: block;width: 100%;border-bottom: 1px solid #cccccc;position: relative;
}.headerRadio[data-v-jzl20210826]:after {content: "";position: absolute;top: -4px;left: -2px;width: 1px;height: 1px;border-radius: 50%;background: #cccccc;border: 5px solid #cccccc;position: absolute;right: 35px;top: 50%;transform: translate(0, -50%);
}
::-webkit-scrollbar {width: 3px;height: 3px;
}::-webkit-scrollbar-thumb {border-radius: 5px;-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);background-color: #99a9bf;
}::-webkit-scrollbar-track {-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);border-radius: 5px;background-color: #d3dce6;
}
</style>
  1. 在使用的页面引入Steps组件,并传入相关数据
<template><div class="content_box"><Steps v-if="dayRecory.length > 0" :data="dayRecory" :Index="5" /></div>
</template><script>
import { reactive, toRefs } from 'vue';
import Steps from './components/Steps/index.vue';
export default {components: { Steps },props: {},setup() {const state = reactive({dayRecory: [{id: 7204928,content: "步骤1",smallClass: "UpdateOutBoundAgingPlanning",bigClass: null,createTime: "2024-01-03",createUser: "Mia",outBoundAgingPlanningId: 1342,status: 0},{id: 7204929,content: "步骤2",smallClass: "UpdateOutBoundAgingPlanning",bigClass: "SCFXD",createTime: "2024-01-04",createUser: "Mia",outBoundAgingPlanningId: 1342,status: 0},{id: 7204929,content: "步骤3",smallClass: "UpdateOutBoundAgingPlanning",bigClass: "SCFXD",createTime: "2024-01-05",createUser: "Mia",outBoundAgingPlanningId: 1342,status: 0},{id: 7204929,content: "步骤4",smallClass: "UpdateOutBoundAgingPlanning",bigClass: "SCFXD",createTime: "2024-03-01",createUser: "Mia",outBoundAgingPlanningId: 1342,status: 0},{id: 7204929,content: "步骤5",smallClass: "UpdateOutBoundAgingPlanning",bigClass: "SCFXD",createTime: "2024-03-01",createUser: "Mia",outBoundAgingPlanningId: 1342,status: 0},{id: 7204929,content: "步骤6",smallClass: "UpdateOutBoundAgingPlanning",bigClass: "SCFXD",createTime: "2024-03-01",createUser: "Mia",outBoundAgingPlanningId: 1342,status: 0},{id: 7204929,content: "步骤7",smallClass: "UpdateOutBoundAgingPlanning",bigClass: "SCFXD",createTime: "2024-03-01",createUser: "Mia",outBoundAgingPlanningId: 1342,status: 0},{id: 7204929,content: "步骤8",smallClass: "UpdateOutBoundAgingPlanning",bigClass: "SCFXD",createTime: "2024-03-01",createUser: "Mia",outBoundAgingPlanningId: 1342,status: 0},{id: 7204929,content: "步骤9",smallClass: "UpdateOutBoundAgingPlanning",bigClass: "SCFXD",createTime: "2024-03-01",createUser: "Mia",outBoundAgingPlanningId: 1342,status: 0},{id: 7204929,content: "步骤10",smallClass: "UpdateOutBoundAgingPlanning",bigClass: "SCFXD",createTime: "2024-03-01",createUser: "Mia",outBoundAgingPlanningId: 1342,status: 1},{id: 7204929,content: "步骤11",smallClass: "UpdateOutBoundAgingPlanning",bigClass: "SCFXD",createTime: "2024-03-01",createUser: "Mia",outBoundAgingPlanningId: 1342,status: 2},{id: 7204929,content: "步骤12",smallClass: "UpdateOutBoundAgingPlanning",bigClass: "SCFXD",createTime: "2024-03-01",createUser: "Mia",outBoundAgingPlanningId: 1342,status: 2},{id: 7204929,content: "步骤13",smallClass: "UpdateOutBoundAgingPlanning",bigClass: "SCFXD",createTime: "2024-03-01",createUser: "Mia",outBoundAgingPlanningId: 1342,status: 2},{id: 7204929,content: "步骤14",smallClass: "UpdateOutBoundAgingPlanning",bigClass: "SCFXD",createTime: "2024-03-01",createUser: "Mia",outBoundAgingPlanningId: 1342,status: 2}],});const methods = {};return {...toRefs(state),...methods};},
};
</script><style scoped lang="scss">
.main-container {margin-left: 0 !important;
}
::v-deep .right-toolbar {width: 800px !important;
}
::v-deep .main-title {display: none !important;
}
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/317583.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

leetcode12 整数转罗马数字

题目描述&#xff1a;给定一个整数&#xff0c;将其转换为罗马数字。罗马数字由七个字符表示&#xff1a;I&#xff08;1&#xff09;、V&#xff08;5&#xff09;、X&#xff08;10&#xff09;、L&#xff08;50&#xff09;、C&#xff08;100&#xff09;、D&#xff08;5…

【Matlab】基于遗传算法优化BP神经网络 (GA-BP)的数据时序预测(附代码)

资源下载&#xff1a; https://download.csdn.net/download/vvoennvv/88682033 目录 【Matlab】BP 神经网络时序预测算法 【Matlab】CNN卷积神经网络时序预测算法 【Matlab】ELM极限学习机时序预测算法 【Matlab】基于遗传算法优化BP神经网络 (GA-BP)的数据时序预测 【Mat…

搭建Python环境

为了能进行Python开发&#xff0c;需要搭建Python环境 搭建运行环境&#xff1a;Python 搭建开发环境&#xff1a;PyCharm 安装Python 1.点开python官网 欢迎来到 Python.orghttps://www.python.org/ 2.选择Downloads&#xff08;下载&#xff09; &#xff08;上面的…

2024年CIO的14大战略优先事项与关键趋势解析

GenAI将成为2024年的核心技术趋势&#xff0c;对CIO来说是主要关注点。他们需负责评估新工具&#xff0c;搭建基础设施&#xff0c;应对潜在风险&#xff0c;并且把握创新的用户体验机会。挑战在于&#xff0c;众多供应商争相推出价格不菲的GenAI功能。CIO需要通过商业案例分析…

MySQL基础篇(一)SQL

视频地址: 黑马程序员 MySQL数据库入门到精通&#xff0c;从mysql安装到mysql高级、mysql优化全囊括 SQL&#xff0c;全称 Structured Query Language&#xff0c;结构化查询语言。操作关系型数据库的编程语言&#xff0c;定义了一套操作关系型数据库统一 标准。 一、SQL通用语…

【力扣题解】P700-二叉搜索树中的搜索-Java题解

&#x1f468;‍&#x1f4bb;博客主页&#xff1a;花无缺 欢迎 点赞&#x1f44d; 收藏⭐ 留言&#x1f4dd; 加关注✅! 本文由 花无缺 原创 收录于专栏 【力扣题解】 文章目录 【力扣题解】P700-二叉搜索树中的搜索-Java题解&#x1f30f;题目描述&#x1f4a1;题解&#x1f…

Python 面向对象之绑定和非绑定方法

Python 面向对象之绑定和非绑定方法 【一】序言 在Python类的成员中分为两类&#xff1a;一个是属性&#xff0c;另一个就是方法&#xff08;就是定义的函数&#xff09;方法又分为两大类&#xff1a;绑定方法&#xff08;动态方法&#xff09;和非绑定方法&#xff08;静态方…

RocketMQ5.0消息过滤

前言 消费者订阅了某个主题后&#xff0c;RocketMQ 会将该主题中的所有消息投递给消费者。若消费者只需要关注部分消息&#xff0c;可通过设置过滤条件在 Broker 端进行过滤&#xff0c;只获取到需要关注的消息子集&#xff0c;避免接收到大量无效的消息。 以电商交易场景为例…

海外住宅IP代理的工作原理和应用场景分析,新手必看

海外住宅IP代理作为一种技术解决方案&#xff0c;为用户提供了访问全球网络资源和维护隐私安全的方法。本文将介绍海外住宅IP代理的工作原理和应用场景&#xff0c;帮助读者更好地理解和利用这一技术。 一、工作原理 海外住宅IP代理的工作原理基于代理服务器和IP地址的转发。它…

Docker实战02|Namespace

在上一文《Docker实战01&#xff5c;容器与开发语言》中主要介绍了Docker的基本概念与Docker安装、Go语言安装等实战技巧。 本文继续针对Namespace技术展开讲解并利用Go语言进行实践。 本系列所有代码均已经开源。关公众号回复「Go语言实现Docker」即可获得。 目录 2.1.2 U…

Spring ApplicationEvent事件处理

Spring的事件 ApplicationEvent以及Listener是Spring为我们提供的一个事件监听、订阅的实现&#xff0c;内部实现原理是观察者设计模式&#xff0c;设计初衷也是为了系统业务逻辑之间的解耦&#xff0c;提高可扩展性以及可维护性。 ApplicationEvent就是Spring的事件接口Applic…

谷歌推出创新SynCLR技术:借助AI生成的数据实现高效图像建模,开启自我训练新纪元!

谷歌推出了一种创新性的合成图像框架&#xff0c;这一框架独特之处在于它完全不依赖真实数据。这个框架首先从合成的图像标题开始&#xff0c;然后基于这些标题生成相应的图像。接下来&#xff0c;通过对比学习的技术进行深度学习&#xff0c;从而训练出能够精准识别和理解这些…