当前位置:网站首页>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
}
],
}
边栏推荐
猜你喜欢

The best landing practice of cave state in an Internet ⽹⾦ financial technology enterprise

【机器学习】VAE变分自编码器学习笔记

使用CMD修复和恢复病毒感染文件

App automation testing Kaiyuan platform appium runner

开源者的自我修养|为 ShardingSphere 贡献了千万行代码的程序员,后来当了 CEO

玩转gRPC—不同编程语言间通信

佩服,阿里女程序卧底 500 多个黑产群……

B站被骂上了热搜。。

Build a vc2010 development environment and create a tutorial of "realizing Tetris game in C language"

使用net core 6 c# 的 NPOI 包,读取excel..xlsx单元格内的图片,并存储到指定服务器
随机推荐
GET请求如何传递数组参数
洞态在某互联⽹⾦融科技企业的最佳落地实践
Uni app realizes advertisement scroll bar
Several models of IO blocking, non blocking, IO multiplexing, signal driven and asynchronous IO
Social distance (cow infection)
小程序-小程序图表库(F2图表库)
6年技术迭代,阿里全球化出海&合规的挑战和探索
Anti fraud, refusing to gamble, safe payment | there are many online investment scams, so it's impossible to make money like this
3.4 data query in introduction to database system - select (single table query, connection query, nested query, set query, multi table query)
MySQL六十六问,两万字+五十图详解!复习必备
【剑指 Offer】55 - II. 平衡二叉树
[Jianzhi offer] 54 The k-th node of binary search tree
盲盒NFT数字藏品平台系统开发(搭建源码)
受益互联网出海 汇量科技业绩重回高增长
新手准备多少钱可以玩期货?农产品可以吗?
User defined annotation realizes the function of verifying information
机器学习总结(一):线性回归、岭回归、Lasso回归
Spark source code reading outline
Solution to 0xc000007b error when running the game [easy to understand]
QT community management system