mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 12:08:13 +08:00
fix:crud filter combo模式不能清空查询条件 (#1990)
Co-authored-by: dqc <qianchuan.deng@gmail.com>
This commit is contained in:
parent
3e9df63fad
commit
f0a22ffba1
@ -784,8 +784,18 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
perPageField,
|
||||
loadDataOnceFetchOnFilter
|
||||
} = this.props;
|
||||
values = syncLocation ? qs.parse(qsstringify(values)) : values;
|
||||
|
||||
values = syncLocation
|
||||
? qs.parse(
|
||||
qsstringify(
|
||||
values,
|
||||
{
|
||||
arrayFormat: 'indices',
|
||||
encodeValuesOnly: true
|
||||
},
|
||||
true
|
||||
)
|
||||
)
|
||||
: values;
|
||||
store.updateQuery(
|
||||
{
|
||||
...values,
|
||||
|
@ -1282,8 +1282,14 @@ export function qsstringify(
|
||||
options: any = {
|
||||
arrayFormat: 'indices',
|
||||
encodeValuesOnly: true
|
||||
}
|
||||
},
|
||||
keepEmptyArray?: boolean
|
||||
) {
|
||||
// qs会保留空字符串。fix: Combo模式的空数组,无法清空。改为存为空字符串;只转换一层
|
||||
keepEmptyArray &&
|
||||
Object.keys(data).forEach((key: any) => {
|
||||
Array.isArray(data[key]) && !data[key].length && (data[key] = '');
|
||||
});
|
||||
return qs.stringify(data, options);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user