横向
实现横向step组件,等分布局(借助flex:1)
<template>
<div class="steps">
<div v-for="item of step" :key="item.title" class="step">
<div class="step-process">
<img :src="icon(item)" />
<div class="line-box">
<span class="step-line"></span>
</div>
</div>
<p :class="addClass(item)">{{ item.status_name }}</p>
</div>
</div>
</template>
<script>
export default {
props: {
step: {
type: Array,
default: () => []
}
},
computed: {
icon() {
return item => (item.is_active ? item.active_icon : item.inactive_icon)
},
addClass() {
return item => (item.is_active ? 'step-title-active text-ellipsis-two' : 'step-title text-ellipsis-two')
}
}
}
</script>
<style lang="scss" scoped>
.text-ellipsis-two {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
}
.steps {
width: 100%;
padding: 24px;
box-sizing: border-box;
display: flex;
justify-content: space-between;
}
.step {
display: flex;
flex-direction: column;
align-content: center;
align-items: center;
flex: 1;
justify-content: flex-start;
&-process {
width: 100%;
display: flex;
flex-wrap: nowrap;
margin-bottom: 8px;
transform: translateX(calc(50% - 28px));
img {
width: 56px;
height: 56px;
}
}
&:last-child .step-process .line-box {
display: none;
}
}
.step-title {
width: 100%;
text-align: center;
font-size: 24px;
color: #222222;
line-height: 29px;
padding: 0px 8px;
box-sizing: border-box;
}
.step-title-active {
width: 100%;
text-align: center;
font-size: 24px;
color: #222222;
line-height: 29px;
font-weight: bold;
padding: 0px 8px;
box-sizing: border-box;
}
.line-box {
width: 100%;
flex-grow: 1;
display: flex;
align-items: center;
justify-content: center;
.step-line {
width: 80%;
border-bottom: 1px solid #222222;
}
}
</style>
纵向
step组件icon的插槽功能
<template>
<div v-if="isShowOrderProductTrack" class="order-tracking-summary-con" @click.stop="showOrderAndProductTrack">
<div class="summary">
<p class="title">{{ orderStatus }}</p>
<p class="desc">{{ orderStatusDesc }}</p>
</div>
<div class="card-content">
<div class="status-card">
<div class="card-title">
<img :src="summaryIcon" alt="" />
<span class="card-title-tips">{{ nodeStatus }}</span>
</div>
<div class="status-desc">
<p class="status-desc-tips">{{ nodeStatusDesc }}</p>
<i class="iconfont iconpayment_back" />
</div>
<p class="time">{{ nodeUpdatedAt }}</p>
</div>
</div>
</div>
</template>
<script>
</script>
<style lang="scss" scoped>
.order-tracking-summary-con {
background: #ffffff;
width: 100%;
border-radius: 14px;
margin-bottom: 20px;
// padding: 111px 0px 8px;
}
.summary {
padding: 20px 24px 0px;
box-sizing: border-box;
width: 100%;
background: url('https://img1.homary.com/common/2021/09/23/a49cbcb2bfb77ac014561e384854a13e.png') no-repeat;
background-size: 100%;
.title {
font-size: 40px;
font-weight: 600;
color: #222222;
line-height: 48px;
word-break: break-word;
}
.desc {
margin-top: 8px;
font-size: 24px;
font-weight: 400;
color: #222222;
line-height: 29px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-transform: capitalize;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
}
}
.card-content {
padding: 20px;
}
.status-card {
padding: 20px;
background: #f9f9f9;
box-sizing: border-box;
border-radius: 13px;
display: flex;
flex-direction: column;
.card-title {
margin-bottom: 12px;
display: flex;
align-items: center;
justify-content: flex-start;
img {
width: 26px;
margin-right: 11px;
}
&-tips {
font-size: 28px;
font-weight: 500;
color: #222222;
line-height: 34px;
}
}
.status-desc {
margin-bottom: 12px;
display: flex;
&-tips {
margin-right: 33px;
width: 90%;
font-size: 24px;
font-weight: 400;
color: #666666;
line-height: 30px;
word-break: break-word;
}
}
.time {
font-size: 24px;
font-weight: 600;
color: #999999;
line-height: 29px;
}
}
.iconpayment_back {
font-size: 24px;
color: #222222;
margin-left: auto;
}
</style>