英文:
buttons styling in confirm Modal
问题
这个项目包含许多接口,其中包括一个用于上传图片的接口,还有一个用于确认删除图片操作的删除按钮。
在图片上可以看到有两个按钮,但我不知道如何为这些按钮添加样式,我需要为“buttons”添加右边距(marginRight)。
如何解决这个问题?
const onGalleryFileRemove = (_file: UploadFile<any>) => {
const { confirm } = Modal;
return new Promise<boolean>((resolve, reject) => {
confirm({
title: <h3 style={{ marginLeft: '3rem' }}>{formatMessage({ id: 'confirmationDeletePicture' })}</h3>,
icon: <ExclamationCircleOutlined style={{ float: 'right' }} />,
onOk: () => {
resolve(true);
},
onCancel: () => {
reject(true);
}
});
});
};
英文:
I have project and this project contains many of interfaces, and among these interfaces, there are interface to upload image, and i have delete button on this image to confirm delete image operation,
and as u can see on the image, there are two buttons, i don't know how can put style to these buttons, i need to put marginRight to "buttons"
how can i solve the problem?
const onGalleryFileRemove = (_file: UploadFile<any>) => {
const { confirm } = Modal
return new Promise<boolean>((resolve, reject) => {
confirm({
title: <h3 style={{ marginLeft: '3rem' }}>{formatMessage({ id: 'confirmationDeletePicture' })}</h3>,
icon: <ExclamationCircleOutlined style={{ float: 'right' }} />,
onOk: () => {
resolve(true)
},
onCancel: () => {
reject(true)
}
})
});
};
答案1
得分: 1
你可以在okButtonProps
和cancelButtonProps
属性中传递样式。
Modal.confirm({
content: 'Hello World',
cancelButtonProps: {
style: {
marginRight: '10px'
}
},
okButtonProps: {
style: {
marginRight: '10px'
}
}
});
英文:
You can pass style in okButtonProps
and cancelButtonProps
props.
Modal.confirm({
content: 'Hello World',
cancelButtonProps: {
style: {
marginRight: '10px'
}
},
okButtonProps: {
style: {
marginRight: '10px'
}
}
});
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论