如何将我的消息发送到 DeleteWithConfirmButton 而不是全局,而只能发送到一个?
我可以全局更改消息:
const messages = {
en: {
ra: {
message: {
delete_contents: 'HELLO?'
}
}
}
};
const i18nProvider = locale => messages[locale];
<Admin
i18nProvider={i18nProvider}
delete_content:"是否确实要删除此项目?", - 默认消息
DeleteWithConfirmButton.propTypes = {
basePath: PropTypes.string,
classes: PropTypes.object,
className: PropTypes.string,
crudDelete: PropTypes.func.isRequired,
label: PropTypes.string,
record: PropTypes.object,
redirect: PropTypes.oneOfType([
PropTypes.string,
PropTypes.bool,
PropTypes.func,
]),
resource: PropTypes.string.isRequired,
translate: PropTypes.func,
icon: PropTypes.element,
};
在当前版本的 React-admin 中,DeleteButton/BulkDeleteButton 组件具有 confirmTitle/confirmContent 属性,用于设置自定义标头和对话框内容:
DeleteWithConfirmButton.propTypes = {
basePath: PropTypes.string,
classes: PropTypes.object,
className: PropTypes.string,
confirmTitle: PropTypes.string,
confirmContent: PropTypes.string,
label: PropTypes.string,
record: PropTypes.any,
redirect: PropTypes.oneOfType([
PropTypes.string,
PropTypes.bool,
PropTypes.func,
]),
resource: PropTypes.string,
icon: PropTypes.element,
};