Commit a1b9bbc2ce61ee27bf7a0fe3d244a8d641867ca1
Committed by
GitHub
1 parent
64d6fece
fix: 重置表单时移除URL中的参数 (#2559)
Showing
1 changed file
with
6 additions
and
1 deletions
src/components/Form/src/hooks/useFormValues.ts
@@ -76,7 +76,12 @@ export function useFormValues({ | @@ -76,7 +76,12 @@ export function useFormValues({ | ||
76 | } | 76 | } |
77 | // Remove spaces | 77 | // Remove spaces |
78 | if (isString(value)) { | 78 | if (isString(value)) { |
79 | - value = value.trim(); | 79 | + // remove params from URL |
80 | + if(value === '') { | ||
81 | + value = undefined; | ||
82 | + }else { | ||
83 | + value = value.trim(); | ||
84 | + } | ||
80 | } | 85 | } |
81 | if (!tryDeconstructArray(key, value, res) && !tryDeconstructObject(key, value, res)) { | 86 | if (!tryDeconstructArray(key, value, res) && !tryDeconstructObject(key, value, res)) { |
82 | // 没有解构成功的,按原样赋值 | 87 | // 没有解构成功的,按原样赋值 |