优化进度条组件,支持根据内容调整高度

This commit is contained in:
fofolee
2025-02-21 16:05:24 +08:00
parent 1e5a4c1ff5
commit 7635f1ac64
4 changed files with 39 additions and 30 deletions

View File

@@ -409,7 +409,10 @@ document.addEventListener("DOMContentLoaded", () => {
processBarInner.style.width = `${value}%`;
}
if (text) {
document.getElementById("process-text").textContent = text;
const processText = document.getElementById("process-text");
processText.innerHTML = text;
processText.scrollTop = processText.scrollHeight;
ipcRenderer.sendTo(parentId, "dialog-ready", calculateHeight());
}
});
@@ -425,9 +428,11 @@ document.addEventListener("DOMContentLoaded", () => {
(buttonBar.style.display !== "none" ? buttonBar.offsetHeight : 0);
const maxHeight = dialogType === "select" ? 620 : 520;
// 进度条的最大高度通过.process-text的max-height限制
const minHeight = dialogType === "process" ? 60 : 100;
// 确保高度在最小值和最大值之间
return Math.min(Math.max(totalHeight, 100), maxHeight);
return Math.min(Math.max(totalHeight, minHeight), maxHeight);
};
// 确定按钮点击事件