ProgressGroup
展示任务各部分的进度占比。
实时预览
正在加载预览…
参数配置
全部字段 10
ProgressGroupItems
列表项 · 3
ProgressSegment
ProgressSegment
ProgressSegment
ProgressGroupOptions
Go 代码
Go
// Inside a view; c is *ui.Context, t is nui.Theme.
nui.ProgressGroup(c.Key("progress"), t, []nui.ProgressSegment{{ID: "code", Label: "Code", Value: 45, Color: nui.Primary}, {ID: "tests", Label: "Tests", Value: 30, Color: nui.Info}, {ID: "docs", Label: "Docs", Value: 15, Color: nui.Warning}}, nui.ProgressGroupOptions{Label: "Project progress", Size: nui.SizeDefault, HideLegend: false, Orientation: nui.Horizontal, Height: 160})使用说明
代码、测试和文档三段使用固定示例数据,可比较隐藏图例和方向变化。每段使用独立 ID、数值和语义颜色,便于连接任务数据。
API 参考
ProgressGroup
源码func ProgressGroup(c *ui.Context, t Theme, segments []ProgressSegment, opts ProgressGroupOptions) ui.ElementProgressGroupOptions
源码type ProgressGroupOptions struct {
Label string
Max Optional[float64]
Color Color
Size Size
HideLegend bool
Orientation Orientation
Height float32
Decoration
}| 字段 | 类型 | 说明 |
|---|---|---|
Label | stringGo 零值: | 控件标签或可访问名称。 |
Max | Optional[float64]Go 零值: | 上界或数量上限,具体含义依组件而定。 |
Color | ColorGo 零值: | 语义颜色;默认值继承主题或组件配色。 |
Size | SizeGo 零值: | 组件尺寸;默认值继承主题或组件尺寸。 |
HideLegend | boolGo 零值: | 隐藏进度分组图例。 |
Orientation | OrientationGo 零值: | 水平或垂直方向;未设置时使用组件默认方向。 |
Height | float32Go 零值: | 高度,单位为 DIP。 |
UI | StylesGo 零值: | 以部件名称为键覆盖外观和间距。 |
Style | func(Slot, ui.Element)Go 零值: | 同步配置当前构建的部件;不要保留 Element。 |