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

Form 表单内置的校验规则 number 无法正确校验数字 #4573

Open
wuyunkui opened this issue Sep 17, 2024 · 1 comment
Open

Form 表单内置的校验规则 number 无法正确校验数字 #4573

wuyunkui opened this issue Sep 17, 2024 · 1 comment

Comments

@wuyunkui
Copy link

tdesign-vue-next 版本

1.10.1

重现链接

No response

重现步骤

<t-form-item>
  <t-button theme="primary" type="submit">提交</t-button>
</t-form-item>
<script lang="ts" setup> import { ref, reactive } from 'vue'; import { MessagePlugin, FormInstanceFunctions, FormProps, } from 'tdesign-vue-next'; const form = ref(null); const formData: FormProps['data'] = reactive({ sort: 0, }); const rules: FormProps['rules'] = { sort: [ { number: true, message: '排序必须为数字', }, ], }; const onSubmit: FormProps['onSubmit'] = ({ validateResult, firstError, e }) => { e.preventDefault(); if (validateResult === true) { MessagePlugin.success('提交成功'); } else { console.log('Validate Errors: ', firstError, validateResult); MessagePlugin.warning(firstError); } }; </script>

期望结果

1726565741277 表单内置规则为: number: true 在表单输入框中输入数字:1234,数值是正确的,但无法通过表单验证。

实际结果

1726565847123 1、在输入框中无论输入数字、文本都不能通过验证 2、在输入框中无论输入数字、文本,点击提交按钮,均出现错误提示,无法提交表单

框架版本

Vue(3.4.29)

浏览器版本

Microsoft Edge 128.0.2739.79 (正式版本) (64 位)

系统版本

Windows 10 专业版 22H2

Node版本

v20.17.0

补充说明

No response

Copy link
Contributor

👋 @wuyunkui,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant