Progress
显示任务进度或不确定加载状态。
实时预览
正在加载预览…
参数配置
全部字段 11
ProgressOptions
Go 代码
Go
// Inside a view; c is *ui.Context, t is nui.Theme.
nui.Progress(c.Key("progress"), t, 60, nui.ProgressOptions{Label: "Progress", Color: nui.ColorDefault, Size: nui.SizeDefault, Indeterminate: false, Orientation: nui.Horizontal})使用说明
调整 value 显示确定进度,或开启 Indeterminate 表示进度未知。此例由参数直接控制数值;真实任务应通过任务状态更新进度。
API 参考
Progress
源码func Progress(c *ui.Context, t Theme, value float64, opts ProgressOptions) ui.ElementProgressOptions
源码type ProgressOptions struct {
Label string
Color Color
Size Size
Max Optional[float64]
Indeterminate, Vertical bool
Orientation Orientation
Inverted bool
Animate Optional[bool]
Decoration
}| 字段 | 类型 | 说明 |
|---|---|---|
Label | stringGo 零值: | 控件标签或可访问名称。 |
Color | ColorGo 零值: | 语义颜色;默认值继承主题或组件配色。 |
Size | SizeGo 零值: | 组件尺寸;默认值继承主题或组件尺寸。 |
Max | Optional[float64]Go 零值: | 上界或数量上限,具体含义依组件而定。 |
Indeterminate | boolGo 零值: | 使用不确定进度状态。 |
Vertical | boolGo 零值: | 启用纵向排列。 |
Orientation | OrientationGo 零值: | 水平或垂直方向;未设置时使用组件默认方向。 |
Inverted | boolGo 零值: | 反转数值或视觉方向。 |
Animate | Optional[bool]Go 零值: | 控制动画,并遵守系统的减少动态效果偏好。 |
UI | StylesGo 零值: | 以部件名称为键覆盖外观和间距。 |
Style | func(Slot, ui.Element)Go 零值: | 同步配置当前构建的部件;不要保留 Element。 |