fix: fix the form-api reactive failure inside the form (#4590)
* fix: fix the form-api reactive failure inside the form
This commit is contained in:
@@ -18,6 +18,7 @@ interface RowType {
|
||||
}
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
collapsed: true,
|
||||
schema: [
|
||||
{
|
||||
component: 'Input',
|
||||
@@ -73,7 +74,7 @@ const gridOptions: VxeGridProps<RowType> = {
|
||||
{ field: 'color', title: 'Color' },
|
||||
{ field: 'productName', title: 'Product Name' },
|
||||
{ field: 'price', title: 'Price' },
|
||||
{ field: 'releaseDate', title: 'Date' },
|
||||
{ field: 'releaseDate', formatter: 'formatDateTime', title: 'Date' },
|
||||
],
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
@@ -95,13 +96,11 @@ const gridOptions: VxeGridProps<RowType> = {
|
||||
const [Grid, gridApi] = useVbenVxeGrid({ formOptions, gridOptions });
|
||||
|
||||
function toggleFormCollspae() {
|
||||
gridApi.formApi.resetForm();
|
||||
gridApi.setState({
|
||||
formOptions: {
|
||||
showCollapseButton: !(
|
||||
gridApi.state?.formOptions?.showCollapseButton ?? true
|
||||
),
|
||||
},
|
||||
gridApi.formApi.setState((prev) => {
|
||||
return {
|
||||
...prev,
|
||||
showCollapseButton: !prev.showCollapseButton,
|
||||
};
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user