跳转到内容

SusProgressLinear ​

SusProgressLinear

水平条形进度 —— 确定、缓冲、条纹或不确定。

包

SusKit · 原子(商业)

在 Playground 中打开

SusKit · Atoms

属性

名称类型默认值
ValueProp<float>0f
MaxProp<float>100f
HeightProp<float>4f
ColorProp<string>"primary"
BgColorProp<string>""
BgOpacityProp<float>1f
BufferValueProp<float>0f
IndeterminateProp<bool>false
ActiveProp<bool>true
StripedProp<bool>false
StreamProp<bool>false
ReverseProp<bool>false
AbsoluteProp<bool>false
ClickableProp<bool>false
RoundedProp<string>"md"
RoundedBarProp<bool>false
ChunkCountProp<int>0
ChunkGapProp<float>4f

插槽

名称
(默认)

事件

名称字段载荷
ValueChangedOnValueChangedfloat

样式钩子 ​

USS 类契约 — 无需改 C# 即可覆盖外观。状态通过这些类切换:

  • sus-hidden
  • sus-progress-linear
  • sus-progress-linear__background
  • sus-progress-linear__buffer
  • sus-progress-linear__chunk
  • sus-progress-linear__chunk-fill
  • sus-progress-linear__chunks
  • sus-progress-linear__content
  • sus-progress-linear__fill
  • sus-progress-linear__indeterminate
  • sus-progress-linear__indeterminate-bar
  • sus-progress-linear__indeterminate-bar--long
  • sus-progress-linear__indeterminate-bar--short
  • sus-progress-linear__stream
  • sus-progress-linear--absolute
  • sus-progress-linear--active
  • sus-progress-linear--chunked
  • sus-progress-linear--clickable
  • sus-progress-linear--color-danger
  • sus-progress-linear--color-info
  • sus-progress-linear--color-secondary
  • sus-progress-linear--color-success
  • sus-progress-linear--color-warning
  • sus-progress-linear--inactive
  • sus-progress-linear--indeterminate
  • sus-progress-linear--reduced
  • sus-progress-linear--reverse
  • sus-progress-linear--rounded-bar
  • sus-progress-linear--stream
  • sus-progress-linear--striped

用法 ​

xml
<template>
  <sus:SusProgressLinear :Value="LoadPct.Value"
                         Max="100"
                         Color="primary"
                         Height="6"
                         Rounded="md" />
</template>

<script>
public Prop<float> LoadPct = new(65f);
</script>
csharp
var bar = new SusProgressLinear();
bar.Value.Value = 40f;
bar.BufferValue.Value = 70f;
bar.Color.Value = "success";
bar.Striped.Value = true;
// Indeterminate: bar.Indeterminate.Value = true;

备注 ​

  • BufferValue 绘制第二条轨道(例如已缓冲的媒体)。
  • ChunkCount / ChunkGap 将填充部分拆分为多个段。
  • 默认插槽叠加在进度条上,用于行内标签。
  • Active(默认 true)只通过类显示或隐藏进度条:Active = false 会在根节点上加 sus-progress-linear--inactive(display: none);组件从不写入 style.display。因此当你自己隐藏进度条时——用 sus-hidden 或进度条上的皮肤规则——只要 Active 为 true,它就保持隐藏。
  • 进度条从树中移除后再加回时,indeterminate 和 stream 动画会重新开始。
  • Reduce motion:SusMotion.Reduce 开启时,不确定态轨道停成一条静止的色带,stream 条纹也静止不动;根元素获得 sus-progress-linear--reduced。关闭该标志后恢复原先的运行模式。