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

希望增加 StringMessage #189

Open
anxuanzi opened this issue Dec 21, 2022 · 2 comments
Open

希望增加 StringMessage #189

anxuanzi opened this issue Dec 21, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@anxuanzi
Copy link

希望可以增加一个StringMessage方法,就像StringRule一样可以把错误消息用 tag 的写法来声明。

@inhere inhere self-assigned this Dec 22, 2022
@inhere
Copy link
Member

inhere commented Dec 22, 2022

可以写个代码示例看看吗?哪种样子的

@anxuanzi
Copy link
Author

就比如说增加规则的时候我可以使用v.StringRule("username", "required|minLen:4|maxLen:12|alphaDash")来设置校验规则。同理可否有一个类似的函数来增加错误消息呢?例如v.StringMessage("username","required:用户名为必填项|minLen:用户名至少 4 个字符|maxLen:用户名最多 12 个字符|alphaDash:用户名只允许字母, 数字, 破折号以及下划线")

@inhere inhere added the enhancement New feature or request label Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants