Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: useVbenVxeGrid的formApi->updateSchema无效 #4588

Closed
5 tasks done
imdap opened this issue Oct 7, 2024 · 0 comments · Fixed by #4590
Closed
5 tasks done

Bug: useVbenVxeGrid的formApi->updateSchema无效 #4588

imdap opened this issue Oct 7, 2024 · 0 comments · Fixed by #4590
Labels
bug Something isn't working

Comments

@imdap
Copy link
Contributor

imdap commented Oct 7, 2024

Version

Vben Admin V5

Describe the bug?

formApi的getState()获取的schema为空数组 导致无法更新schema

updateSchema(schema: Partial<FormSchema>[]) {
    console.log('updateSchema', schema);
    const updated: Partial<FormSchema>[] = [...schema];
    const hasField = updated.every(
      (item) => Reflect.has(item, 'fieldName') && item.fieldName,
    );

    if (!hasField) {
      console.error(
        'All items in the schema array must have a valid `fieldName` property to be updated',
      );
      return;
    }
   // 这里获取的为空数组
    const currentSchema = [...(this.state?.schema ?? [])];

Reproduction

const [BasicTable, tableApi] = useVbenVxeGrid({...})

onMouted(() => {
  // 获取的schema为空
  console.log(tableApi.formApi.getState());
});
image

System Info

Binaries:
    Node: 20.16.0 - ~/.nvm/versions/node/v20.16.0/bin/node
    npm: 10.8.1 - ~/.nvm/versions/node/v20.16.0/bin/npm
    pnpm: 9.8.0 - ~/.nvm/versions/node/v20.16.0/bin/pnpm
  Browsers:
    Chrome: 129.0.6668.90
    Safari: 18.0.1

Relevant log output

No response

Validations

@anncwb anncwb added the bug Something isn't working label Oct 7, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants