Files
cz-web/src/components/StepForm.vue
2026-10-01 17:24:57 +08:00

78 lines
1.5 KiB
Vue

<script setup lang="ts">
interface Props {
titles: string[]
current: number
}
defineProps<Props>()
</script>
<template>
<div class="step-form">
<div class="step-form__header">
<template v-for="(title, index) in titles" :key="title">
<div
class="step-form__step"
:class="{ 'is-active': index === current, 'is-done': index < current }"
>
<span class="step-form__dot">{{ index + 1 }}</span>
<span class="step-form__label">{{ title }}</span>
</div>
<div v-if="index < titles.length - 1" class="step-form__line" />
</template>
</div>
<div class="step-form__body">
<slot />
</div>
</div>
</template>
<style lang="less" scoped>
.step-form {
padding: @spacing-lg @spacing-xl;
border-radius: @radius-base;
background: @white;
box-shadow: none;
&__header {
.flex(column, flex-start, baseline);
gap: @spacing-base;
margin-bottom: @spacing-lg;
padding-bottom: 0;
border-bottom: none;
}
&__step {
.flex(row, baseline);
gap: @spacing-xs;
}
&__dot {
flex-shrink: 0;
width: 46px;
border: none;
border-radius: 0;
background: transparent;
font-size: 37px;
font-weight: 500;
line-height: 1;
color: @demand-accent;
text-align: left;
}
&__label {
font-size: @font-size-title;
font-weight: 500;
color: @demand-heading;
}
&__line {
display: none;
}
&__body {
margin-left: 46px;
}
}
</style>