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

类型验证的疑惑 #310

Open
schooltech opened this issue May 6, 2022 · 1 comment
Open

类型验证的疑惑 #310

schooltech opened this issue May 6, 2022 · 1 comment

Comments

@schooltech
Copy link

你好,下面是代码:

discount: [
{
required: false,
type: "number",
message: "请在折扣金额文字框中输入正确的数字格式",
trigger: 'blur',
transform(value) {
return parseFloat(value);
},
}
],

改成v-model.number 之后,只能输入整数,而且blur之后,空着也不行,还必须录入内容,type为float时,只能输入5.33这样的数字,不带小数点不行,小数点后面为0也不行
这个怎么解决,感谢

@haobarry
Copy link

表单最好用数字表单, 我之前用正则,只要再一堆字符里面又数字就验证通过了,所有后来换成数字表单就直接过滤掉非数字内容了

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

2 participants