vue想要对身份证进行展示,但是又不想对其年月日部分进行展示,可以尝试是使用正则的方法进行脱敏处理。
if(this.ownerVo.ownerCard.length >= 10){
let str = this.ownerVo.ownerCard
str = str.replace(/(\w{6})\w*(\w{4})/,'$1******$2');
this.ownerVo.ownerCard = str
}
效果图如下:

vue想要对身份证进行展示,但是又不想对其年月日部分进行展示,可以尝试是使用正则的方法进行脱敏处理。
if(this.ownerVo.ownerCard.length >= 10){
let str = this.ownerVo.ownerCard
str = str.replace(/(\w{6})\w*(\w{4})/,'$1******$2');
this.ownerVo.ownerCard = str
}
效果图如下:

858
5150
5941
2859

被折叠的 条评论
为什么被折叠?