feat: 优化模态框按钮配置逻辑,支持动态按钮数量
This commit is contained in:
@@ -73,6 +73,10 @@
|
||||
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
|
||||
[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
font-size: 14px;
|
||||
|
||||
@@ -315,9 +315,12 @@ function openActionModal({ title, message, actions, option, buildResult }) {
|
||||
autoStartMessage.textContent = message;
|
||||
currentModalActions = actions || [];
|
||||
modalResultBuilder = typeof buildResult === 'function' ? buildResult : null;
|
||||
configureActionModalButton(btnAutoStartCancel, currentModalActions[0]);
|
||||
configureActionModalButton(btnAutoStartRestart, currentModalActions[1]);
|
||||
configureActionModalButton(btnAutoStartContinue, currentModalActions[2]);
|
||||
const buttonSlots = currentModalActions.length <= 2
|
||||
? [btnAutoStartCancel, btnAutoStartContinue]
|
||||
: [btnAutoStartCancel, btnAutoStartRestart, btnAutoStartContinue];
|
||||
buttonSlots.forEach((button, index) => {
|
||||
configureActionModalButton(button, currentModalActions[index]);
|
||||
});
|
||||
configureActionModalOption(option);
|
||||
autoStartModal.hidden = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user