ElementUI Timeline 時間線
阿新 • • 發佈:2022-01-06
一、概述
視覺化地呈現時間流資訊。
官方連結:https://element.eleme.cn/#/zh-CN/component/timeline
二、優化
官方列舉的樣式,不符合實際需求,因此需要自己寫一個。
test.vue
<template> <div style="width: 50%"> <div class="handle-list"> <div class="data-title"> <div style="border-bottom: 1px solid #eee;margin-bottom: 20px;"View Code></div> <div class="press text">處理進度</div> <div class="des text">描述</div> <div class="users text">處理人員</div> <div class="times text">處理時間</div> </div> <div> <div class="data-title handle-items"v-for='(item,index) in processData' :key="item.id"> <div class="press"> <div class="handle-items-icons"> <div class="icon" :class="{'icon-circle' :index==0}"></div> <div class="icon-line" v-if="item.status>1"></div> <div class="icon-line-last" v-if="index==processData.length"></div> </div> <div class="handle-message handle-message1" style="margin-left: 20px;"> <div class="item-name">{{ item.process }}</div> </div> </div> <div class="des"> <div class="handle-message handle-message1"> <div class="item-name">{{ item.desc }}</div> </div> </div> <div class="users"> <div class="handle-message handle-message1"> <div class="item-name">{{ item.operate }}</div> </div> </div> <div class="times"> <div class="handle-message handle-message1"> <div class="item-name">{{ item.createTime }}</div> </div> </div> </div> </div> </div> </div> </template> <script> export default { data() { return { texts: ['差', '一般', '好', '非常好', '非常棒'], value: null, processData: [ { id:4, process:'完成工單', status:4, desc:'快件已經簽收,簽收人:本人', operate:'小張', createTime:'2021/09/17 09:58:52' }, { id:3, process:'快件到達', status:3, desc:'快件已經到達北京市豐臺區', operate:'小張', createTime:'2021/09/17 08:58:52' }, { id: 2, process: '分派工單', status: 2, desc: '已分派工單給小王【12345678910】', operate: '小張', createTime: '2021/09/16 21:58:52' }, { id: 1, process: '建立工單', status: 1, desc: '已建立工單【202109162058】', operate: '小張', createTime: '2021/09/16 20:58:52' }, ] } }, methods: {}, } </script> <style rel="stylesheet/scss" lang="scss" scoped> .data-title { border-bottom: 1px solid #eee; margin-bottom: 20px; display: flex; } .press { width: 100px; } .des { flex: 1; } .users { width: 120px; } .times { width: 160px; } .text { height: 13px; font-size: 13px; font-family: PingFangSC-Regular, PingFang SC; font-weight: 400; color: #999999; line-height: 13px; } .handle-list { margin-bottom: 20px; .handle-items { display: flex; position: relative; border-bottom: none; margin-bottom: 0; padding-bottom: 37px; .handle-items-icons { position: absolute; height: 100%; width: 10px; display: flex; flex-direction: column; align-items: center; .icon { /*position:absolute;*/ width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid #CCCCCC; box-sizing: border-box; } .icon-circle { border: none; background: linear-gradient(134deg, #3D98FF 0%, #8086E4 100%); } .icon-line { width: 1px; flex: 1; background: linear-gradient(180deg, #CCCCCC 0%, rgba(204, 204, 204, 0.2) 100%); } .icon-line-last { width: 1px; height: 100%; background: linear-gradient(207deg, #2C81EC 0%, rgba(44, 129, 236, 0.2) 100%); } } .handle-message { /*display: flex;*/ // justify-content: center; align-items: center; font-size: 13px; font-weight: 400; color: #333333; line-height: 18px; .item-name { /*width: 56px;*/ height: 14px; font-size: 14px; font-family: PingFangSC-Regular, PingFang SC; font-weight: 400; color: #333333; line-height: 14px; } } .handle-message1 { padding-bottom: 0; } } .handle-items1 { padding-bottom: 15px; } } </style>
效果如下: