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