| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 | <template>	<view class="">		<view			class="u-steps"			:style="{				flexDirection: direction			}"		>			<view class="u-steps__item" 				:class="['u-steps__item--' + direction]" 				v-for="(item, index) in list" :key="index"			>				<view					class="u-steps__item__num"					v-if="mode == 'number'"					:style="{						backgroundColor: current < index ? 'transparent' : activeColor,						borderColor: current < index ? unActiveColor : activeColor					}"				>					<text v-if="current < index" :style="{						color: current < index ? unActiveColor : activeColor,					}">						{{ index + 1 }}					</text>					<u-icon v-else size="22" color="#ffffff" :name="icon"></u-icon>				</view>				<view class="u-steps__item__dot" v-if="mode == 'dot'" :style="{ 					backgroundColor: index <= current ? activeColor : unActiveColor 				}"></view>				<text class="u-line-1" :style="{ 					color: index <= current ? activeColor : unActiveColor,				}" :class="['u-steps__item__text--' + direction]">					{{ item.name }}				</text>				<view class="u-steps__item__line" :class="['u-steps__item__line--' + mode]" v-if="index < list.length - 1">					<u-line :direction="direction" length="100%" :hair-line="false" :color="unActiveColor"></u-line>				</view>			</view>		</view>	</view></template><script>export default {	name: 'u-steps',	props: {				mode: {			type: String,			default: 'dot'		},				list: {			type: Array,			default() {				return [];			}		},				type: {			type: String,			default: 'primary'		},				current: {			type: [Number, String],			default: 0		},				activeColor: {			type: String,			default: '#2979ff'		},				unActiveColor: {			type: String,			default: '#909399'		},				icon: {			type: String,			default: 'checkmark'		},				direction: {			type: String,			default: 'row'		}	},	data() {		return {};	},};</script><style lang="scss" scoped>@import '../../libs/css/style.components.scss';$u-steps-item-number-width: 44rpx;$u-steps-item-dot-width: 20rpx;.u-steps {	@include vue-flex;		.u-steps__item {		flex: 1;		text-align: center;		position: relative;		min-width: 100rpx;		font-size: 26rpx;		color: #8799a3;		@include vue-flex;		justify-content: center;		flex-direction: column;		align-items: center;				&--row {			@include vue-flex;			flex-direction: column;						.u-steps__item__line {				position: absolute;				z-index: 0;				left: 75%;				width: 50%;								&--dot {					top: calc(#{$u-steps-item-dot-width} / 2);				}								&--number {					top: calc(#{$u-steps-item-number-width} / 2);				}			}		}				&--column {			@include vue-flex;			flex-direction: row;			justify-content: flex-start;			min-height: 120rpx;						.u-steps__item__line {				position: absolute;				z-index: 0;				height: 50%;				top: 75%;								&--dot {					left: calc(#{$u-steps-item-dot-width} / 2);				}								&--number {					left: calc(#{$u-steps-item-number-width} / 2);				}			}		}				&__num {			@include vue-flex;			align-items: center;			justify-content: center;			width: $u-steps-item-number-width;			height: $u-steps-item-number-width;			border: 1px solid #8799a3;			border-radius: 50%;			overflow: hidden;		}				&__dot {			width: $u-steps-item-dot-width;			height: $u-steps-item-dot-width;			@include vue-flex;			border-radius: 50%;		}				&__text--row {			margin-top: 14rpx;		}				&__text--column {			margin-left: 14rpx;		}	}}</style>
 |