Home > Web Front-end > JS Tutorial > body text

How to operate vue input input to verify the alphanumeric combination and the length is less than 30

php中世界最好的语言
Release: 2018-05-29 14:55:14
Original
6911 people have browsed it

This time I will show you how to operate vue input to input a verification alphanumeric combination and the length is less than 30. How to operate vue input to enter a verification alphanumeric combination and the length is less than 30. What are the precautions? are as follows. This is a practical case, let’s take a look at it.

The following code is for everyone to share with you the vue input verification alphanumeric combination and the length is less than 30. The specific code is as follows:

<Input v-model="form.glhm" placeholder="请输入关联交易号" style="width:240px" @on-blur="validateJyh(form.glhm)"></Input> 
validateJyh(glhm){//校验关联交易号 
    var reg = /^[A-Za-z0-9]{1,30}$/; 
    if(!reg.test(glhm)){ 
     this.$Message.error("请输入字母或数字组成的交易关联号"); 
     this.form.glhm = &#39;&#39;; 
    } 
   },
Copy after login

Look below in Vue.Js The el-input box can only be used to enter numbers and limit the number of digits. It also limits Chinese input and paste

var tr = document.getElementById("Id1"), // 取得ID为Id1的tr对象
 inps = tr.getElementsByTagName(&#39;input&#39;); // 从tr 对象中获取所有input对象
for(var i = 0, len = inps.length; i < len; i++) {
 inps[i].value = &#39;&#39;; // 将每一个input的value置为空
}
document.getElementById("t").getElementsByTagName(&#39;input&#39;)[0].value=&#39;&#39;;
Copy after login

How to enter Chinese and leave it blank

<el-input
@change="checkNo(searchForm.msel.mselTotalConsumTimes)"
type = "text"
onkeypress="return event.keyCode>=48&&event.keyCode<=57"
size="small"
:maxlength="6"
style="width: 120px"
v-model="searchForm.msel.mselTotalConsumTimes"></el-input>
 次
</el-col>
checkNo(value){
let reg = /^[1-9]\d*$/;
if (value) {
if (value >
999999 || new
RegExp(reg).test(value) ==
false) {
setTimeout(() 
=> {
this.searchForm.msel.mselTotalConsumTimes =&#39;&#39;;
   }, 500);
}
}
},
Copy after login

I believe I have read this article You have mastered the case method. For more exciting information, please pay attention to other related articles on the PHP Chinese website!

Recommended reading:

How to use Vue to make Amap and build a real-time bus application

How to use seajs in require Writing convention

The above is the detailed content of How to operate vue input input to verify the alphanumeric combination and the length is less than 30. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template