| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- <template>
- <view class="step">
- <view class="step-list">
- <view v-for="i in options.length" :key="i" class="step-item" :style="{ width: `${100 / options.length}%` }">
- <view class="item-li" :class="[
- currentStep <= i ? '' : 'ok',
- currentStep === i ? 'active' : '',
- ]">
- <view :class="[i == 1 ? '' : 'step-dash step-dash1']"></view>
- <image v-if="currentStep > i" src="/static/images/success.png" alt="" />
- <text v-else></text>
- <view :class="[i == options.length ? '' : 'step-dash step-dash2']"></view>
- </view>
- </view>
- </view>
- <view class="step-ul">
- <view v-for="t in options" :key="t" class="step-li" :style="{ width: `${100 / options.length}%` }">
- {{ t }}
- </view>
- </view>
- </view>
- </template>
- <script setup lang="ts">
- const props = defineProps<{
- currentStep: number;
- options: Array<string>;
- }>();
- </script>
- <style scoped lang="scss">
- @import "@/uni.scss";
- .step {
- padding-bottom: px2rpx(31);
- .step-list {
- display: flex;
- align-items: center;
- .step-item {
- display: flex;
- justify-content: center;
- align-items: center;
- .item-li {
- display: flex;
- width: 100%;
- justify-content: center;
- align-items: center;
- span {
- display: inline-block;
- width: px2rpx(44);
- height: px2rpx(44);
- aspect-ratio: 1/1;
- border-radius: 114px;
- border: 2px solid #beb6b6;
- position: relative;
- &::after {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- content: "";
- width: px2rpx(4);
- height: px2rpx(4);
- border-radius: 50%;
- background: #beb6b6;
- }
- }
- em {
- height: px2rpx(2);
- flex: 1 0 0;
- background: transparent;
- }
- .step-dash {
- height: px2rpx(2);
- flex: 1 0 0;
- background: #beb6b6;
- }
- img {
- display: inline-block;
- width: px2rpx(44);
- height: px2rpx(44);
- }
- }
- .active {
- span {
- display: inline-block;
- width: px2rpx(44);
- height: px2rpx(44);
- aspect-ratio: 1/1;
- border-radius: 114px;
- border: 2px solid #ff4766;
- position: relative;
- &::after {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- content: "";
- width: px2rpx(4);
- height: px2rpx(4);
- border-radius: 50%;
- background: #ff4766;
- }
- }
- em {
- height: px2rpx(2);
- flex: 1 0 0;
- background: transparent;
- }
- .step-dash {
- height: px2rpx(2);
- flex: 1 0 0;
- background: #beb6b6;
- }
- .step-dash1 {
- background: #ff4766;
- }
- }
- .ok {
- span {
- display: inline-block;
- width: px2rpx(44);
- height: px2rpx(44);
- aspect-ratio: 1/1;
- border-radius: 114px;
- border: 2px solid #ff4766;
- position: relative;
- &::after {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- content: "";
- width: px2rpx(4);
- height: px2rpx(4);
- border-radius: 50%;
- background: #ff4766;
- }
- }
- em {
- height: px2rpx(2);
- flex: 1 0 0;
- background: transparent;
- }
- .step-dash {
- height: px2rpx(2);
- flex: 1 0 0;
- background: #ff4766;
- }
- }
- }
- }
- .step-ul {
- display: flex;
- justify-content: space-between;
- align-items: flex-start;
- color: #474747;
- text-align: center;
- font-family: Roboto;
- font-size: px2rpx(14);
- font-style: normal;
- font-weight: 400;
- line-height: px2rpx(20);
- letter-spacing: px2rpx(0.014);
- .step-li {
- text-align: center;
- }
- }
- }
- </style>
|