ant-design / ant-design/pro-components
🐛[BUG] submitButtonProps = false不生效, 提交按钮还是会显示
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 1.4k
- Avg merge
- 10h 44m
- Merged PRs (30d)
- 3
Description
提问前先看看:
https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md
### 🐛 bug 描述
设置submitButtonProps为false没有效果, resetButtonProps为false是会生效的
```
return (
{
const finalValues = transformKey(
formRef.current?.getFieldsValue(),
omitNil,
);
submitterProps?.onReset?.(finalValues);
onReset?.(finalValues);
// 如果 syncToUrl,清空一下数据
if (syncToUrl) {
// 把没有的值设置为未定义可以删掉 url 的参数
const params = Object.keys(
transformKey(formRef.current?.getFieldsValue(), false),
).reduce((pre, next) => {
return {
...pre,
[next]: finalValues[next] || undefined,
};
}, extraUrlParams);
/** 在同步到 url 上时对参数进行转化 */
onUrlSearchChange(genParams(syncToUrl, params || {}, 'set'));
}
}}
// 这里重写了submitButtonProps导致为false不生效
submitButtonProps={{
loading,
...submitterProps.submitButtonProps,
}}
/>
);
```
### 📷 复现步骤
### 🏞 期望结果
submitButtonProps为false时隐藏
### 💻 复现代码
### © 版本信息
- ProComponents 版本: 2.7.14
- umi 版本
- 浏览器环境
- 开发环境 [e.g. mac OS]
### 🚑 其他信息
Contributor guide
Research direction
Start at the Submitter rendering code shown in the issue and trace how submitterProps.submitButtonProps is merged before reaching the submit button. Reproduce the case with submitButtonProps set to false, then add a regression test covering the false value and verify that the submit button is hidden while resetButtonProps continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100