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
按照官网的文档,当不使用校验的时候,输入框的 clear 事件没能触发 form 的 change 事件,导致获取的值是旧的过时的值
最小复现:
<script setup> import { ref } from 'vue'; const form = ref({}) const formRef = ref() const options = [ { field: 'field1', label: 'field1', as: 'input', props: { clearable: true } // ← 允许清空,且不做校验 }, { field: 'field2', label: 'field2', as: 'input', props: { clearable: true } // ← 允许清空,且不做校验 }, { as: 'button', props: { text: '提交', async request(){ // 文本框的 clear 事件没能触发 form 的 change 函数,导致清空之后 获取的还是上一次的值 console.log(JSON.stringify(form.value)) } } }, ] </script> <template> <lew-flex width="500" x="start" y="start" :gap="50"> <lew-form ref="formRef" :options="options" @change="e => { form = e }" /> </lew-flex> </template>
The text was updated successfully, but these errors were encountered:
方法使用错误了,不应该用change来获取form的值,可以试试formRef.value.getForm(),这个方法是获取最新的表单绑定值。
Sorry, something went wrong.
这个set和get的两个方法 是这个form的核心。
非常感谢,上面是跟着官网的示例来写的,当时没想那么多
No branches or pull requests
按照官网的文档,当不使用校验的时候,输入框的 clear 事件没能触发 form 的 change 事件,导致获取的值是旧的过时的值
最小复现:
The text was updated successfully, but these errors were encountered: