export default function confirm(config: ModalFuncProps) {
const div = document.createElement('div');
document.body.appendChild(div);
// eslint-disable-next-line no-use-before-define
let currentConfig = { ...config, close, visible: true } as any;
function render({ okText, cancelText, prefixCls, ...props }: any) {
/**
* https://github.com/ant-design/ant-design/issues/23623
* Sync render blocks React event. Let's make this async.
*/
setTimeout(() => {
// js 코드로 Modal 컴포넌트를 렌더링합니다.
ReactDOM.render(
<ConfirmDialog
{...props}
prefixCls={prefixCls || `${getRootPrefixCls()}-modal`}
rootPrefixCls={getRootPrefixCls()}
okText={okText || (props.okCancel ? runtimeLocale.okText : runtimeLocale.justOkText)}
cancelText={cancelText || runtimeLocale.cancelText}
/>,
div,
);
});
}
// render 함수를 호출합니다.
render(currentConfig);
return {
destroy: close,
update,
};
}
Last active
April 18, 2021 05:58
-
-
Save qkreltms/b2800c8f58f985be5bd897d567530fed to your computer and use it in GitHub Desktop.
awdaw.md
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment