vue-vben-admin
vue-vben-admin copied to clipboard
Bug: 重置表单没有重置对应的字段
Version
Vben Admin V5
Describe the bug?
重置表单,并没有重置映射的字段。
- 选择筛选字段 build_platform,点击搜索按钮。
- 点击重置按钮,表单清空,但是formValues里面build_platform还是有值的
Reproduction
const gridOptions: VxeGridProps<TaskApi.TaskTable> = {
...gridSchemas,
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await getTaskTable({
...formValues
page: page.currentPage,
limit: page.pageSize,
});
},
},
},
};
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
...searchFormSchemas,
schema: [
{
fieldName: 'build_platform',
label: $t('task.list.buildPlatform'),
component: 'Select',
componentProps: {
allowClear: true,
options: buildPlatformOpts,
onChange: (value: string) => {
filters.build_platform = value;
},
},
},
],
handleReset: async () => {
gridApi.formApi.resetForm();
gridApi.reload();
},
},
gridOptions,
});
System Info
System:
OS: Linux 6.8 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
CPU: (16) x64 13th Gen Intel(R) Core(TM) i7-13620H
Memory: 25.89 GB / 38.87 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 20.18.1 - ~/.nvm/versions/node/v20.18.1/bin/node
npm: 10.8.2 - ~/.nvm/versions/node/v20.18.1/bin/npm
pnpm: 9.15.9 - ~/.nvm/versions/node/v20.18.1/bin/pnpm
Browsers:
Chrome: 133.0.6943.141
Chromium: 135.0.7049.84
Relevant log output
Validations
- [x] Read the docs
- [x] Ensure the code is up to date. (Some issues have been fixed in the latest version)
- [x] I have searched the existing issues and checked that my issue does not duplicate any existing issues.
- [x] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [x] The provided reproduction is a minimal reproducible example of the bug.