gpt4 book ai didi

regex - Vue.js - 元素 UI - 表单验证正则表达式

转载 作者:行者123 更新时间:2023-12-04 17:31:24 26 4
gpt4 key购买 nike

我想使用 vue-js 2.3 验证表单和 element-ui显然,他们使用 async-validator来验证表单。文档是 here .
例子
https://jsfiddle.net/skd3nyqh/
问题

Uncaught Error: Unknown rule type D*([2-9]d{2})(D*)([2-9]d{2})(D*)(d{4})D*


我不知道如何使用 regexp 验证字段.我发现有关该主题的文档不够明确。

最佳答案

来自 documentation .

Pattern

The pattern rule property indicates a regular expression that the value must match to pass validation.




{required: true, pattern:/\D*([2-9]\d{2})(\D*)([2-9]\d{2})(\D*)(\d{4})\D*/, message: 'Please input phone', trigger: 'blur' }

更新 fiddle .

关于regex - Vue.js - 元素 UI - 表单验证正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44395768/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com