bricks/dist/docs/en/progressbar.md
yumoqing 2e22085122 feat: 401后登录成功自动重试原始请求
- withLoginInfo 改为接收完整 opts(含 method/headers/params)
- 等待 login_window 的 destroy 事件(=登录成功信号)
- 登录成功后重试原始请求
- 重试仍401则返回null(避免死循环)
- 用户手动关闭登录窗口时也触发重试,401则返回null
2026-05-27 15:39:34 +08:00

1.7 KiB

ProgressBar

Control Function: Displays a progress bar to visually represent the percentage completion of a task.
Type: Standard control (extension based on the container control HBox)
Parent Control: bricks.HBox

Initialization Parameters

Parameter Name Type Description
total_value Number (Optional) The total value of the task, used to calculate the progress percentage. Defaults to 100.
bar_cwidth Number (Optional) The height of the progress bar in units of line height. Defaults to 2.

Note

: In the actual code, this.bar_cwidth || 2 is used, but total_value is not utilized within the constructor. It should likely be used in the set_value method together with current and total. There appears to be an issue with undefined variables (current and total) in the current implementation.

Main Events

  • No explicitly defined events: The source code does not bind or trigger any custom events.
  • The control may inherit basic layout events from HBox, but no additional events are registered.

⚠️ Code Issue Notice:

  • In the set_value method, the variables current and total are used but not defined. They should be replaced with v and this.total_value.
  • There is inconsistency in variable naming within the percentage calculation logic: pzt = (current / total) * 100 is calculated first, then percentage is used later. This should be unified using v / this.total_value.

Recommended Fix:

set_value(v) {
    var percentage = this.total_value ? (v / this.total_value) * 100 : 0;
    percentage = Math.max(0, Math.min(100, percentage));
    this.text_w.set_style('width', percentage + '%');
}