<!-- DIY步骤条 --> <script lang="ts" setup name="SkyStep"> const props = defineProps({ stepList: { type: Array<any>, }, }) </script> <template> <div> <ul class="diy-steps"> <li v-for="(item, index) in props.stepList" :key="index"> <div class="diy-step"> <div v-if="index === 0 && item.status === 'undone'" class="diy-step-line_left" :style="'background-image: linear-gradient(' + '90deg' + ', #ffffff, #bbbbbb)'" /> <div v-if="index === 0 && item.status !== 'undone'" class="diy-step-line_left" :style="'background-image: linear-gradient(' + '90deg' + ', #ffffff, #4cb45b)'" /> <div v-else-if="index !== 0 && item.status === 'undone'" class="diy-step-line_left" :style="'background-image: linear-gradient(' + '0deg' + ', #bbbbbb, #bbbbbb)'" /> <div v-else-if="index !== 0 && item.status !== 'undone'" class="diy-step-line_left" :style="'background-image: linear-gradient(' + '0deg' + ', #4cb45b, #4cb45b)'" /> <div v-if="item.status === 'success'" class="diy-step-box diy-step__success"> <span> <i class="el-icon-check" /> </span> <strong>{{ item.label }}</strong> <strong>{{ item.time }}</strong> </div> <div v-else-if="item.status === 'fail'" class="diy-step-box diy-step__fail"> <span> <i class="el-icon-close" /> </span> <strong>{{ item.label }}</strong> <strong>{{ item.time }}</strong> </div> <div v-else-if="item.status === 'doing'" class="diy-step-box diy-step__doing"> <span> <i class="" /> </span> <strong>{{ item.label }}</strong> <strong>{{ item.time }}</strong> </div> <div v-else-if="item.status === 'undone'" class="diy-step-box diy-step__undone"> <span> <i class="" /> </span> <strong>{{ item.label }}</strong> <strong>{{ item.time }}</strong> </div> <div v-if="props.stepList!.length && index === props.stepList!.length - 1 && item.status === 'success'" class="diy-step-line_right" :style="'background-image: linear-gradient(' + '90deg' + ', #4cb45b, #ffffff)'" /> <div v-else-if="index === props.stepList!.length - 1 && item.status === 'fail'" class="diy-step-line_right" :style="'background-image: linear-gradient(' + '90deg' + ', #4cb45b, #ffffff)'" /> <div v-else-if="index === props.stepList!.length - 1 && item.status === 'doing'" class="diy-step-line_right" :style="'background-image: linear-gradient(' + '90deg' + ', #bbbbbb, #ffffff)'" /> <div v-else-if="index === props.stepList!.length - 1 && item.status === 'undone'" class="diy-step-line_right" :style="'background-image: linear-gradient(' + '90deg' + ', #bbbbbb, #ffffff)'" /> <div v-else-if="index !== props.stepList!.length - 1 && item.status === 'undone' && (index + 1 <= props.stepList!.length - 1) && props.stepList![index + 1].status === 'undone' " class="diy-step-line_right" :style="'background-image: linear-gradient(' + '180deg' + ', #bbbbbb, #bbbbbb)'" /> <div v-else-if="index !== props.stepList!.length - 1 && item.status === 'undone' && (index + 1 <= props.stepList!.length - 1) && props.stepList![index + 1].status === 'success' " class="diy-step-line_right" :style="'background-image: linear-gradient(' + '180deg' + ', #bbbbbb, #4cb45b)'" /> <div v-else-if="index !== props.stepList!.length - 1 && item.status !== 'undone' && (index + 1 <= props.stepList!.length - 1) && props.stepList![index + 1].status === 'undone' " class="diy-step-line_right" :style="'background-image: linear-gradient(' + '180deg' + ', #bbbbbb, #bbbbbb)'" /> <div v-else-if="index !== props.stepList!.length - 1 && item.status !== 'undone' && (index + 1 <= props.stepList!.length - 1) && stepList![index + 1].status !== 'undone' " class="diy-step-line_right" :style="'background-image: linear-gradient(' + '180deg' + ', #4cb45b, #4cb45b)'" /> </div> </li> </ul> </div> </template> <style lang="scss" scoped> .diy-steps { display: flex; width: 100%; height: 100px; margin: 15px auto 0; padding: 0; position: relative; font-family: "微软雅黑"; overflow: hidden; } .diy-steps li { width: auto; height: 100%; flex: 1; list-style-type: none; font-size: 12px; text-align: center; position: relative; float: left; } .diy-steps li .diy-step { width: 100%; display: inline-block; position: relative; z-index: 1; } .diy-step-line_left { border-bottom: 1px solid transparent; background: linear-gradient(90deg, #bbb, #4cb45b); width: 50%; height: 2px; display: inline-block; position: absolute; top: 9px; left: 0; z-index: 0; } .diy-step-line_right { border-bottom: 1px solid transparent; background: linear-gradient(180deg, #bbb, #4cb45b); width: 50%; height: 2px; display: inline-block; position: absolute; top: 9px; right: 0; z-index: 0; } .diy-steps li .diy-step .diy-step-box { position: relative; z-index: 1; } .diy-steps li .diy-step .diy-step-box span { display: block; width: 21px; height: 21px; border-radius: 100%; color: #fff; // transform: scale(1.2); text-align: center; margin: 0 auto 8px; } .diy-steps li .diy-step .diy-step-box span i { display: block; width: 13px; height: 13px; border-radius: 100%; line-height: 13px; } .diy-steps li .diy-step .diy-step-box strong { letter-spacing: 0.5px; } /* diy-step__success */ .diy-step__success span { border: rgb(55 171 71 / 20%) 4px solid; border: rgb(215 238 218) 4px solid; } .diy-step__success span i { background-color: #37ab47; } .diy-step__success strong { color: #37ab47; } /* / diy-step__success */ /* diy-step__fail */ .diy-step__fail span { border: rgb(252 94 90 / 20%) 4px solid; border: rgb(254 223 222) 4px solid; } .diy-step__fail span i { background-color: #fc5e5a; } .diy-step__fail strong { color: #fc5e5a; } /* / diy-step__fail */ /* diy-step__doing */ .diy-step__doing span { border: rgb(94 124 224 / 20%) 4px solid; border: rgb(223 229 249) 4px solid; } .diy-step__doing span i { background-color: #5e7ce0; } .diy-step__doing strong { color: #5e7ce0; } /* / diy-step__doing */ /* diy-step__undone */ .diy-step__undone span { border: rgb(153 153 153 / 20%) 4px solid; border: rgb(235 235 235) 4px solid; } .diy-step__undone span i { background-color: #999; } .diy-step__undone strong { color: #999; } /* / diy-step__undone */ </style>