We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Vben Admin V5
在useVbenModal中使用From表单,在onOpenChange中调用formApi中的setState会报错:this.form?.setFieldValue is not a function 我当前的解决方法是在formApi.setState外层加一个计时器可以解决
<script lang="ts" setup> import { useVbenForm, useVbenModal } from '@vben/common-ui'; import { ElButton } from 'element-plus'; const [Form, formApi] = useVbenForm({ commonConfig: { // 所有表单项 componentProps: { class: 'w-full' }, }, layout: 'horizontal', wrapperClass: 'grid-cols-1', schema: [ { component: 'Input', fieldName: 'field', label: '测试节点', }, ], }); const [Modal, modalApi] = useVbenModal({ onCancel() { modalApi.close(); }, async onOpenChange(isOpen: boolean) { if (isOpen) { formApi.setState((prev) => ({ schema: prev.schema?.filter((item) => item.fieldName !== 'field'), })); } }, }); const openModal = () => { modalApi.open(); }; </script> <template> <div> <Modal class="w-[500px]" title="添加分类"> <Form /> </Modal> <ElButton @click="openModal()">打开窗口</ElButton> </div> </template>
OS: macOS 15.1.1 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Google Chrome: 最新版本
No response
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Version
Vben Admin V5
Describe the bug?
在useVbenModal中使用From表单,在onOpenChange中调用formApi中的setState会报错:this.form?.setFieldValue is not a function
![image](https://private-user-images.githubusercontent.com/45890956/403322148-a98d954a-b5da-4f4c-ad2b-ee89e36d6b68.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NDA1NjcsIm5iZiI6MTczOTQ0MDI2NywicGF0aCI6Ii80NTg5MDk1Ni80MDMzMjIxNDgtYTk4ZDk1NGEtYjVkYS00ZjRjLWFkMmItZWU4OWUzNmQ2YjY4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA5NTEwN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc4NDdhMTI5NmJjYTU5ZDUyMjNkMmVlNTVjY2EyMjlhMzdmOTg4Yjg2OWJkNzdlYTIzMmVkOWI4ZGIyMjM5NzcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.dgOOk-j4ozO4NpS3RL5PowvjPSSnFJw8CGy9D-IbF9Q)
我当前的解决方法是在formApi.setState外层加一个计时器可以解决
Reproduction
System Info
Relevant log output
No response
Validations
The text was updated successfully, but these errors were encountered: