diff --git a/src/packages/dialog/dialog.scss b/src/packages/dialog/dialog.scss index 0aed9a8a87..5dcbc5194a 100644 --- a/src/packages/dialog/dialog.scss +++ b/src/packages/dialog/dialog.scss @@ -8,7 +8,9 @@ align-items: center; width: $dialog-width; min-width: $dialog-min-width; + /* #ifndef harmony*/ max-height: 67%; + /* #endif */ min-height: $dialog-min-height; padding: $dialog-padding; box-sizing: border-box; @@ -112,15 +114,10 @@ min-width: 100%; } - .nut-dialog-footer-ok { - order: 1; - } - .nut-dialog-footer-cancel { margin: 0; color: $color-text; font-size: $font-size-base; - order: 2; display: flex; justify-content: center; margin-top: $dialog-vertical-footer-ok-margin-top; diff --git a/src/packages/dialog/dialog.taro.tsx b/src/packages/dialog/dialog.taro.tsx index 9f14971362..328399ed47 100644 --- a/src/packages/dialog/dialog.taro.tsx +++ b/src/packages/dialog/dialog.taro.tsx @@ -122,43 +122,68 @@ export const BaseDialog: FunctionComponent> & { const btnClass = hideCancelButton || hideConfirmButton ? `${classPrefix}-footer-block` : '' + const renderCancelOfVertical = () => { + return ( + !hideCancelButton && ( + handleCancel(e)} + > + {cancelText || locale.cancel} + + ) + ) + } + + const renderCancel = () => { + return ( + !hideCancelButton && ( + + ) + ) + } + + const renderConfirm = () => { + return ( + !hideConfirmButton && ( + + ) + ) + } + return ( footer || ( <> - {!hideCancelButton && - (footerDirection === 'vertical' ? ( - handleCancel(e)} - > - {cancelText || locale.cancel} - - ) : ( - - ))} - - {!hideConfirmButton && ( - + {footerDirection === 'vertical' ? ( + <> + {renderConfirm()} + {renderCancelOfVertical()} + + ) : ( + <> + {renderCancel()} + {renderConfirm()} + )} ) @@ -193,46 +218,52 @@ export const BaseDialog: FunctionComponent> & { } } + const renderContent = () => { + return ( + + + {content || children} + + + ) + } + return ( - <> - {overlay && ( - - )} - - - - {content || children} - - - + {renderContent()} + + ) : ( + renderContent() + )} ) } diff --git a/src/packages/dialog/dialog.tsx b/src/packages/dialog/dialog.tsx index c049d16c61..e1bb241f5d 100644 --- a/src/packages/dialog/dialog.tsx +++ b/src/packages/dialog/dialog.tsx @@ -93,6 +93,7 @@ const BaseDialog: ForwardRefRenderFunction< {!hideCancelButton && (footerDirection === 'vertical' ? (
handleCancel(e)} >