当前位置:网站首页>座机的表单验证
座机的表单验证
2022-07-29 03:38:00 【勇敢牛牛,冲冲冲】
landlineValidatorFn (value) {
// 对座机号码进行验证 长度最大15位,允许输入"-"
let validText = new Text().verify(value);
if (validText) {
return validText;
}
if (value.length >= 15) {
return _('最大允许座机号15位');
}
if (value.includes(' ')) {
return _('座机不允许输入空格');
}
if (value.length === 1) {
let tmp = value;
if (isNaN(parseInt(tmp, 10))) {
if (!(value === '-')) {
return _('请输入数字或者-');
}
}
} else {
let arr = value.split('');
let res = arr.every(function (item) {
//every 一假即假
if (isNaN(parseInt(item, 10))) {
if (item === '-') {
return true;
}
return false;
}
return true;
});
if (!res) {
return _('请输入数字或者-');
}
}
return true;
},
边栏推荐
- Sleuth+Zipkin 来进行分布式服务链路的追踪
- 深入C语言(4)——switch的定义与使用
- Violence recursion to dynamic programming 01 (robot movement)
- Simple use of eventbus
- Realize multi-level linkage through recursion
- Asynchronous callback future mode of concurrent mode
- Excel拼接数据库语句
- LeetCode 1331 数组序号转换[Map] HERODING的LeetCode之路
- Sanzi chess (player + computer)
- Mathematical modeling -- analytic hierarchy process model
猜你喜欢

Use of leak scanning (vulnerability scanning) tool burpsuite or burp Suite (with installation and installation package download of burpsuite+1.7.26)

(codeforce547) c-mike and foam

makefile详解

Summarize the knowledge points of the ten JVM modules. If you don't believe it, you still don't understand it

Reproduce 20 character short domain name bypass and XSS related knowledge points

How to deploy sentinel cluster of redis

KNN method predicts pregnancy, KNN principle simple code

Bingbing learning notes: operator overloading -- implementation of date class

Ten thousand words detailed Google play online application standard package format AAB

ROS - create workspace
随机推荐
暴力递归到动态规划 01 (机器人移动)
(nowcoder22529c) diner (inclusion exclusion principle + permutation and combination)
ShardingSphere之水平分表实战(三)
最新二开版漫画小说听书三合一完整源码/整合免签接口/搭建教程/带采集接口
1. 头文件-注释-命名空间-标准输入输出流
Microcomputer principle operation
实例搭建Flask服务(简易版)
three.js 第五十四用如何给shader传递结构体数组
机器学习【Numpy】
Matlab learning - accumulation of small knowledge points
Flutter 启动白屏
Vs code must know and know 20 shortcut keys!
Various minor problems of jupyter notebook, configuration environment, code completion, remote connection, etc
Learn exkmp again (exkmp template)
【科技1】
Realize multi-level linkage through recursion
Rdkit I: using rdkit to screen the structural characteristics of chemical small molecules
Mathematical modeling -- analytic hierarchy process model
HDU multi School Game 2 1011 DOS card
深入C语言(3)—— C的输入输出流