当前位置:网站首页>El form item regular verification
El form item regular verification
2022-07-01 13:48:00 【A fake front-end man】
<el-form-item label=" Name of commodity " prop="name">
<el-input type="text" v-model.trim="param.name" style="width:640px" @change="handleChange" maxlength="30" ></el-input>
</el-form-item>
rules:{
name: [
{
validator: (rule, value, callback) => {
console.log(value, 'lail ')
if (!value) {
callback(new Error(' Please enter the product name '))
} else {
let chinese = []
let noChinese = []
chinese = value.split('').filter(item => {
return /^[\u4e00-\u9fa5]{0,}$/.test(item) === true
})
noChinese = value.split('').filter(item => {
return /^[\u4e00-\u9fa5]{0,}$/.test(item) !== true
})
var num = chinese.length * 2 + noChinese.length
console.log(num)
if (num < 4 || num > 30) {
callback(new Error(' Please enter 2 To 15 The Chinese characters .'))
}
}
},
trigger: 'blur',
required: true
}
],
}
边栏推荐
猜你喜欢

“国防七子”经费暴增,清华足足362亿元,甩第二名101亿 |全国高校2022预算大公开...

队列的基本操作(C语言实现)

孔松(信通院)-数字化时代云安全能力建设及趋势

8 popular recommended style layout

When you really learn databinding, you will find "this thing is really fragrant"!
![[flask] flask starts and implements a minimal application based on flask](/img/45/77df241c85c4916914a37bb78275a5.png)
[flask] flask starts and implements a minimal application based on flask

研发效能度量框架解读

玩转MongoDB—搭建MongoDB集群

QT社团管理系统

Etcd 概要 机制 和使用场景
随机推荐
Liu Dui (fire line safety) - risk discovery in cloudy environment
开源者的自我修养|为 ShardingSphere 贡献了千万行代码的程序员,后来当了 CEO
04 redis source code data structure dictionary
spark源码阅读总纲
8款最佳实践,保护你的 IaC 安全!
【剑指Offer】54. 二叉搜索树的第k大节点
Grafana reports an error: error= "failed to send notification to email addresses: [email protected] : 535 Error:
[flask] flask starts and implements a minimal application based on flask
About fossage 2.0 "meta force meta universe system development logic scheme (details)
“国防七子”经费暴增,清华足足362亿元,甩第二名101亿 |全国高校2022预算大公开...
队列的基本操作(C语言实现)
MySQL六十六问,两万字+五十图详解!复习必备
Etcd 概要 机制 和使用场景
当你真的学会DataBinding后,你会发现“这玩意真香”!
User defined annotation realizes the function of verifying information
Introduction to distributed transactions (Seata)
3.4 《数据库系统概论》之数据查询—SELECT(单表查询、连接查询、嵌套查询、集合查询、多表查询)
Machine learning summary (I): linear regression, ridge regression, Lasso regression
Spark source code (V) how does dagscheduler taskscheduler cooperate with submitting tasks, and what is the corresponding relationship between application, job, stage, taskset, and task?
Self cultivation of open source programmers who contributed tens of millions of lines of code to shardingsphere and later became CEO