当前位置:网站首页>[input ID number] is replaced by an asterisk, and input is cut into multiple small squares (similar)
[input ID number] is replaced by an asterisk, and input is cut into multiple small squares (similar)
2022-07-28 21:09:00 【Hey, little apple】
The first one is , ID number check , also Specific date Show **** Instead of
<div class="list">
<div> ID number </div>
<input placeholder=" Please input ID card number " type="text" v-model="idNumber" @blur="idNumberFun"/>
</div>
idNumberFun(){
var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
if(reg.test(this.idNumber) === false){
this.$toast(' Please enter the correct ID number ');
return false;
}
this.requstIdNumber = this.idNumber
this.idNumber = this.changeIdCardIncludeStart(this.idNumber)
console.log(this.idNumber,'-===',this.requstIdNumber)
},
changeIdCardIncludeStart (cardId) {
const newStr = cardId.replace(/^(.{6})(?:\d+)(.{4})$/,"$1****$2");
return newStr;
},
The second kind , coordination vant Of ID card keyboard
<div class="cardbox" @click="open">
<span>{
{
card1}}</span>
<span>{
{
card2}}</span>
<span>{
{
card3}}</span>
<span>{
{
card4}}</span>
<span>{
{
card5}}</span>
<span>{
{
card6}}</span>
<span>{
{
card7}}</span>
<span>{
{
card8}}</span>
<span>{
{
card9}}</span>
<span>{
{
card10}}</span>
<span class="xingbox">*</span>
<span class="xingbox">*</span>
<span class="xingbox">*</span>
<span class="xingbox">*</span>
<span>{
{
card15}}</span>
<span>{
{
card16}}</span>
<span>{
{
card17}}</span>
<span>{
{
card18}}</span>
</div>
<van-number-keyboard
v-model="value"
extra-key="X"
close-button-text=" complete "
:show="showKeyboard"
@blur="closekeyboard"
@close="closekeyboard"
/>
data() {
return {
value: '', // watch monitor Real time input Numbers
showKeyboard: false, // Whether the keyboard pops up
cardarr:[], // Deposit Input number Array
card1:'',
card2:'',
card3:'',
card4:'',
card5:'',
card6:'',
card7:'',
card8:'',
card9:'',
card10:'',
card15:'',
card16:'',
card17:'',
card18:'',
xing:'*'
}
}
watch: {
value(value) {
// character string turn Array Be similar to 123 turn 【1,2,3】
this.cardarr = [ ...value ]
// Because in the middle Four digit turn **** Instead of , therefore , A total of 14 Digit number
if(this.cardarr.length > 14){
this.cardarr = this.cardarr.splice(0,14);
this.value = this.value.substring(0,14);
}
this.card1 = this.cardarr[0]
this.card2 = this.cardarr[1]
this.card3 = this.cardarr[2]
this.card4 = this.cardarr[3]
this.card5 = this.cardarr[4]
this.card6 = this.cardarr[5]
this.card7 = this.cardarr[6]
this.card8 = this.cardarr[7]
this.card9 = this.cardarr[8]
this.card10 = this.cardarr[9]
this.card15 = this.cardarr[10]
this.card16 = this.cardarr[11]
this.card17 = this.cardarr[12]
this.card18 = this.cardarr[13]
},
},
// Open the keyboard
methods:{
open(){
this.showKeyboard = true
this.cardarr = []
this.value = ''
this.card1 = ''
this.card2 = ''
this.card3 = ''
this.card4 = ''
this.card5 = ''
this.card6 = ''
this.card7 = ''
this.card8 = ''
this.card9 = ''
this.card10 = ''
this.card15 = ''
this.card16 = ''
this.card17 = ''
this.card18 = ''
},
// Turn off the keyboard
closekeyboard(){
this.showKeyboard = false
if(this.cardarr.length < 14){
this.$toast(' Please enter the correct ID number ');
return false;
}
this.idNumber = this.value
this.requstIdNumber = this.idNumber
// ID number Spliced like this 4108820000****1222
this.requstIdNumber = this.requstIdNumber.slice(0,10) + "****" + this.requstIdNumber.slice(10,14)
},
}
边栏推荐
- Understanding of C # delegate
- SQL audit tool self introduction owls
- After Europe, it entered Japan and South Korea again, and the globalization of Pico consumer VR accelerated
- Interpretation of ue4.25 slate source code
- Two written interview questions about regular
- 1 Introduction to command mode
- Efficientformer: lightweight vit backbone
- Observer mode, object pool
- 又一款装机神器
- Baklib | why do enterprises need to pay attention to customer experience?
猜你喜欢
Explain in detail the rays and radiographic testing in unity
Moco V2: further upgrade of Moco series
Confession of a graduate student: why am I addicted to opengauss community?
什么是 CI/CD? | 实现更快更好的软件交付
智能家居行业发展,密切关注边缘计算和小程序容器技术
Unit editor details
Efficientformer: lightweight vit backbone
Explain mesh Collider in unity
A 58 year old native of Anhui Province, he has become the largest IPO investor in Switzerland this year
DeiT:注意力Attention也能蒸馏
随机推荐
【input 身份证号】星号 代替,input 切割成 多个 小格格(类似)
Explain prefabrication in unity in detail
The development of smart home industry pays close attention to edge computing and applet container technology
【TiDB】txt文档导入数据库,这样做真的很高效
Deit: attention can also be distilled
ctfshow 网络迷踪做题记录(1)
Color finder actual combat (QT including source code)
Interpretation of netappp SP sensors output content
mfc wpf winform(工业用mfc还是qt)
九鑫智能正式加入openGauss社区
SQL audit tool self introduction owls
查询oracle视图创建语句及如何向视图中插入数据[通俗易懂]
Unity foundation 4 common plug-ins
Unity foundation 3- data persistence
58岁安徽人,干出瑞士今年最大IPO 投资界
第六七八次作业
The EMC vnx5200 fault light is on, but there is no hardware fault prompt
What functions does MySQL have? Don't look everywhere. Just look at this.
Basic operations of unity3d scene production
mysql梳理复习内容--附思维导图