el-input验证手机号
时间: 2023-10-08 16:04:47 浏览: 121
验证手机号码
5星 · 资源好评率100%
el-input组件可以用于验证手机号。在该组件中,可以通过设置prop属性为"CellPhone"来定义手机号字段,并设置相应的验证规则。例如,可以设置required为true来确保手机号不能为空,同时可以使用正则表达式验证手机号的格式是否正确。例如,可以使用以下规则进行手机号验证:
```javascript
rules: {
CellPhone: [
{ required: true, message: '手机号不能为空', trigger: 'blur' },
{ pattern: /^1<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [【手机号验证/前端】Vue2+elementUI编写一个手机号验证码登录页面,路由式开发(附完整代码)](https://blog.csdn.net/TIG_JS/article/details/129447382)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [el-select 做联级筛选(包含其他功能点)](https://download.csdn.net/download/hippyoo/87401802)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [el-input手机号,座机号,邮箱,银行卡,邮编,传真验证](https://blog.csdn.net/csdnyp/article/details/118762677)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文