当前位置:网站首页>el-form-item 正则验证
el-form-item 正则验证
2022-07-01 13:47:00 【一个假的前端男】
<el-form-item label="商品名称" 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('请输入商品名称'))
} 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('请输入2到15个汉字。'))
}
}
},
trigger: 'blur',
required: true
}
],
}
边栏推荐
- C语言订餐管理系统
- 使用CMD修复和恢复病毒感染文件
- Error:Kotlin: Module was compiled with an incompatible version of Kotlin. The binary version of its
- 【241. 为运算表达式设计优先级】
- The best landing practice of cave state in an Internet ⽹⾦ financial technology enterprise
- Introduction to distributed transactions (Seata)
- word2vec训练中文词向量
- [anwangbei 2021] Rev WP
- Machine learning summary (I): linear regression, ridge regression, Lasso regression
- 面试题目总结(1) https中间人攻击,ConcurrentHashMap的原理 ,serialVersionUID常量,redis单线程,
猜你喜欢

2022上半年英特尔有哪些“硬核创新”?看这张图就知道了!

04 redis source code data structure dictionary

6年技术迭代,阿里全球化出海&合规的挑战和探索

Fiori applications are shared through the enhancement of adaptation project

B站被骂上了热搜。。

Explain IO multiplexing, select, poll, epoll in detail

Self cultivation of open source programmers who contributed tens of millions of lines of code to shardingsphere and later became CEO

Computer network interview knowledge points

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

Google Earth engine (GEE) - Global Human Settlements grid data 1975-1990-2000-2014 (p2016)
随机推荐
MySQL 66 questions, 20000 words + 50 pictures in detail! Necessary for review
1. Sum of two numbers: given an integer array num and an integer target value, please find the two integers whose sum is the target value target in the array and return their array subscripts
Liu Dui (fire line safety) - risk discovery in cloudy environment
spark源码(五)DAGScheduler TaskScheduler如何配合提交任务,application、job、stage、taskset、task对应关系是什么?
B站被骂上了热搜。。
介绍一种对 SAP GUI 里的收藏夹事务码管理工具增强的实现方案
How much money do novices prepare to play futures? Is agricultural products OK?
04-Redis源码数据结构之字典
基于算力驱动、数据与功能协同的分布式动态(协同)渲染/功能运行时
2022 · 让我带你Jetpack架构组件从入门到精通 — Lifecycle
陈宇(Aqua)-安全-&gt;云安全-&gt;多云安全
一文读懂TDengine的窗口查询功能
Build a vc2010 development environment and create a tutorial of "realizing Tetris game in C language"
Kongsong (Xintong Institute) - cloud security capacity building and trend in the digital era
程序设计的基本概念
GET请求如何传递数组参数
LeetCode重建二叉树详解[通俗易懂]
Applet - applet chart Library (F2 chart Library)
Word2vec training Chinese word vector
受益互联网出海 汇量科技业绩重回高增长