Progress

显示任务进度或不确定加载状态。

实时预览

正在加载预览…

参数配置

全部字段 11

ProgressOptions

Styles · 0

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.Element

ProgressOptions

源码
type ProgressOptions struct {
	Label                   string
	Color                   Color
	Size                    Size
	Max                     Optional[float64]
	Indeterminate, Vertical bool
	Orientation             Orientation
	Inverted                bool
	Animate                 Optional[bool]
	Decoration
}
字段类型说明
Labelstring

Go 零值: ""

控件标签或可访问名称。

ColorColor

Go 零值: ColorDefault

语义颜色;默认值继承主题或组件配色。

SizeSize

Go 零值: SizeDefault

组件尺寸;默认值继承主题或组件尺寸。

MaxOptional[float64]

Go 零值: unset

上界或数量上限,具体含义依组件而定。

Indeterminatebool

Go 零值: false

使用不确定进度状态。

Verticalbool

Go 零值: false

启用纵向排列。

OrientationOrientation

Go 零值: zero value

水平或垂直方向;未设置时使用组件默认方向。

Invertedbool

Go 零值: false

反转数值或视觉方向。

AnimateOptional[bool]

Go 零值: unset

控制动画,并遵守系统的减少动态效果偏好。

UIStyles

Go 零值: zero value

以部件名称为键覆盖外观和间距。

Stylefunc(Slot, ui.Element)

Go 零值: nil

同步配置当前构建的部件;不要保留 Element。