当前位置:网站首页>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
}
],
}
边栏推荐
- Kongsong (Xintong Institute) - cloud security capacity building and trend in the digital era
- 运行游戏时出现0xc000007b错误的解决方法[通俗易懂]
- Qtdeisgner, pyuic detailed use tutorial interface and function logic separation (nanny teaching)
- spark源码阅读总纲
- 自定义注解实现验证信息的功能
- 【IoT毕设.下】STM32+机智云AIoT+实验室安全监控系统
- 洞态在某互联⽹⾦融科技企业的最佳落地实践
- 10. Page layout, guess you like it
- 陈宇(Aqua)-安全-&gt;云安全-&gt;多云安全
- 刘对(火线安全)-多云环境的风险发现
猜你喜欢
Fiori applications are shared through the enhancement of adaptation project
AnimeSR:可学习的降质算子与新的真实世界动漫VSR数据集
【IoT毕设.上】STM32+机智云AIoT+实验室安全监控系统
MySQL六十六问,两万字+五十图详解!复习必备
SAP 智能机器人流程自动化(iRPA)解决方案分享
Liu Dui (fire line safety) - risk discovery in cloudy environment
Beidou communication module Beidou GPS module Beidou communication terminal DTU
2022 · 让我带你Jetpack架构组件从入门到精通 — Lifecycle
Enter the top six! Boyun's sales ranking in China's cloud management software market continues to rise
spark源码(五)DAGScheduler TaskScheduler如何配合提交任务,application、job、stage、taskset、task对应关系是什么?
随机推荐
IO的几种模型 阻塞,非阻塞,io多路复用,信号驱动和异步io
minimum spanning tree
Several models of IO blocking, non blocking, IO multiplexing, signal driven and asynchronous IO
ArrayList capacity expansion mechanism and thread safety
When you really learn databinding, you will find "this thing is really fragrant"!
【剑指 Offer】55 - II. 平衡二叉树
Self cultivation of open source programmers who contributed tens of millions of lines of code to shardingsphere and later became CEO
leetcode 322. Coin Change 零钱兑换(中等)
Global and Chinese polypropylene industry prospect analysis and market demand forecast report Ⓝ 2022 ~ 2027
Applet - multiple text line breaks in view
使用CMD修复和恢复病毒感染文件
French Data Protection Agency: using Google Analytics or violating gdpr
【IoT毕设.下】STM32+机智云AIoT+实验室安全监控系统
Fiori applications are shared through the enhancement of adaptation project
QT学习管理系统
算网融合赋能行业转型,移动云点亮数智未来新路标
MySQL 66 questions, 20000 words + 50 pictures in detail! Necessary for review
[anwangbei 2021] Rev WP
Analysis report on the development prospect and investment strategy of the global and Chinese laser chip industry Ⓑ 2022 ~ 2027
当你真的学会DataBinding后,你会发现“这玩意真香”!