Stepper
引导用户完成分步流程。
实时预览
正在加载预览…
参数配置
全部字段 11
StepperItems
列表项 · 3
StepItem
StepItem
StepItem
StepperOptions
Go 代码
Go
// Inside a view; c is *ui.Context, t is nui.Theme.
// Keep s (example state) outside the view. See the complete example.
nui.Stepper(c.Key("stepper"), t, &s.Step, []nui.StepItem{{ID: "details", Title: "Details", Description: "Project name"}, {ID: "team", Title: "Team", Description: "Invite members"}, {ID: "review", Title: "Review", Description: "Confirm changes"}}, nui.StepperOptions{Label: "Setup", Color: nui.ColorDefault, Size: nui.SizeDefault, Vertical: false, Disabled: false, Linear: nui.Optional[bool]{}})使用说明
依次选择 Details、Team 与 Review,比较 Linear 和纵向排列。Stepper 展示步骤与当前进度;各步骤的表单内容、校验和提交逻辑由应用组合。
API 参考
Stepper
源码func Stepper(c *ui.Context, t Theme, value *string, items []StepItem, o StepperOptions) ui.ElementStepperOptions
源码type StepperOptions struct {
Label string
Vertical, Disabled bool
// Linear defaults to true, as Nuxt's: a step can be reached only after
// the one before it. Set(false) allows any available step.
Linear Optional[bool]
Color Color
Size Size
CanSelect func(string) bool
OnChange func(string)
Decoration
}| 字段 | 类型 | 说明 |
|---|---|---|
Label | stringGo 零值: | 控件标签或可访问名称。 |
Vertical | boolGo 零值: | 启用纵向排列。 |
Disabled | boolGo 零值: | 禁用组件及其交互。 |
Linear | Optional[bool]Go 零值: | 按顺序推进步骤;未设置时通常为 true。 |
Color | ColorGo 零值: | 语义颜色;默认值继承主题或组件配色。 |
Size | SizeGo 零值: | 组件尺寸;默认值继承主题或组件尺寸。 |
CanSelect | func(string) boolGo 零值: | 判断某个步骤是否可以进入。 |
OnChange | func(string)Go 零值: | 值发生变化时通知应用的回调。 |
UI | StylesGo 零值: | 以部件名称为键覆盖外观和间距。 |
Style | func(Slot, ui.Element)Go 零值: | 同步配置当前构建的部件;不要保留 Element。 |