内容与导航
默认插槽接收当前步骤与导航方法。可组合 Card、Button 等组件;只有使用插槽时才渲染内容区。
内容插槽始终挂载,如何切换、保留或重置内部内容由调用方决定。组件实例也暴露 next()、prev()、goTo(step),与插槽内的方法行为一致。
步骤 A
这里是第 1 步的内容。
<script setup lang="ts">
import { Stepper, Button, Card, Inline, Stack, Text } from '@hina-ui/vue'
const items = [
{ title: '步骤 A', description: '第一项的说明' },
{ title: '步骤 B', description: '第二项包含更长的说明文字,支持自然换行' },
{ title: '步骤 C', description: '最后一项的说明' },
]
</script>
<template>
<Stepper :items="items">
<template #default="{ item, step, next, prev, canNext, canPrev }">
<Card>
<Stack gap="lg">
<Text weight="medium">{{ item?.title }}</Text>
<Text tone="muted">这里是第 {{ step }} 步的内容。</Text>
<Inline justify="between">
<Button variant="outline" tone="neutral" :disabled="!canPrev" @click="prev">
上一步
</Button>
<Button :disabled="!canNext" @click="next">下一步</Button>
</Inline>
</Stack>
</Card>
</template>
</Stepper>
</template>