- withLoginInfo 改为接收完整 opts(含 method/headers/params) - 等待 login_window 的 destroy 事件(=登录成功信号) - 登录成功后重试原始请求 - 重试仍401则返回null(避免死循环) - 用户手动关闭登录窗口时也触发重试,401则返回null
1.7 KiB
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 || 2is used, buttotal_valueis not utilized within the constructor. It should likely be used in theset_valuemethod together withcurrentandtotal. There appears to be an issue with undefined variables (currentandtotal) 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_valuemethod, the variablescurrentandtotalare used but not defined. They should be replaced withvandthis.total_value.- There is inconsistency in variable naming within the percentage calculation logic:
pzt = (current / total) * 100is calculated first, thenpercentageis used later. This should be unified usingv / 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 + '%'); }