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

2024-01-04 10:20

本文主要是介绍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>

这篇关于vue 实现拐弯时间线,弯曲时间线,弯曲任务步骤条的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/569011

相关文章

全面解析HTML5中Checkbox标签

《全面解析HTML5中Checkbox标签》Checkbox是HTML5中非常重要的表单元素之一,通过合理使用其属性和样式自定义方法,可以为用户提供丰富多样的交互体验,这篇文章给大家介绍HTML5中C... 在html5中,Checkbox(复选框)是一种常用的表单元素,允许用户在一组选项中选择多个项目。本

HTML5 搜索框Search Box详解

《HTML5搜索框SearchBox详解》HTML5的搜索框是一个强大的工具,能够有效提升用户体验,通过结合自动补全功能和适当的样式,可以创建出既美观又实用的搜索界面,这篇文章给大家介绍HTML5... html5 搜索框(Search Box)详解搜索框是一个用于输入查询内容的控件,通常用于网站或应用程

Python pip下载包及所有依赖到指定文件夹的步骤说明

《Pythonpip下载包及所有依赖到指定文件夹的步骤说明》为了方便开发和部署,我们常常需要将Python项目所依赖的第三方包导出到本地文件夹中,:本文主要介绍Pythonpip下载包及所有依... 目录步骤说明命令格式示例参数说明离线安装方法注意事项总结要使用pip下载包及其所有依赖到指定文件夹,请按照以

Python实现精准提取 PDF中的文本,表格与图片

《Python实现精准提取PDF中的文本,表格与图片》在实际的系统开发中,处理PDF文件不仅限于读取整页文本,还有提取文档中的表格数据,图片或特定区域的内容,下面我们来看看如何使用Python实... 目录安装 python 库提取 PDF 文本内容:获取整页文本与指定区域内容获取页面上的所有文本内容获取

基于Python实现一个Windows Tree命令工具

《基于Python实现一个WindowsTree命令工具》今天想要在Windows平台的CMD命令终端窗口中使用像Linux下的tree命令,打印一下目录结构层级树,然而还真有tree命令,但是发现... 目录引言实现代码使用说明可用选项示例用法功能特点添加到环境变量方法一:创建批处理文件并添加到PATH1

Java使用HttpClient实现图片下载与本地保存功能

《Java使用HttpClient实现图片下载与本地保存功能》在当今数字化时代,网络资源的获取与处理已成为软件开发中的常见需求,其中,图片作为网络上最常见的资源之一,其下载与保存功能在许多应用场景中都... 目录引言一、Apache HttpClient简介二、技术栈与环境准备三、实现图片下载与保存功能1.

C++ 函数 strftime 和时间格式示例详解

《C++函数strftime和时间格式示例详解》strftime是C/C++标准库中用于格式化日期和时间的函数,定义在ctime头文件中,它将tm结构体中的时间信息转换为指定格式的字符串,是处理... 目录C++ 函数 strftipythonme 详解一、函数原型二、功能描述三、格式字符串说明四、返回值五

canal实现mysql数据同步的详细过程

《canal实现mysql数据同步的详细过程》:本文主要介绍canal实现mysql数据同步的详细过程,本文通过实例图文相结合给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的... 目录1、canal下载2、mysql同步用户创建和授权3、canal admin安装和启动4、canal

CSS3中的字体及相关属性详解

《CSS3中的字体及相关属性详解》:本文主要介绍了CSS3中的字体及相关属性,详细内容请阅读本文,希望能对你有所帮助... 字体网页字体的三个来源:用户机器上安装的字体,放心使用。保存在第三方网站上的字体,例如Typekit和Google,可以link标签链接到你的页面上。保存在你自己Web服务器上的字

使用jenv工具管理多个JDK版本的方法步骤

《使用jenv工具管理多个JDK版本的方法步骤》jenv是一个开源的Java环境管理工具,旨在帮助开发者在同一台机器上轻松管理和切换多个Java版本,:本文主要介绍使用jenv工具管理多个JD... 目录一、jenv到底是干啥的?二、jenv的核心功能(一)管理多个Java版本(二)支持插件扩展(三)环境隔