vue将电话号码中间的几位数隐藏显示

 

vue中具体用法:

phoneNumFilter (phone) {
// 1字符串转化成数组
let phoneArr = [...phone];
// 2.将数组中的4-7位变成*
phoneArr.map((res, index) => {
if (index > 2 && index < 7) {
this.str += '*';
// return '*';
} else {
this.str += res;
// return res;
}
});
return this.str;
}

 

此处仅作交流学习,版权归原作者所有

posted @ 2020-01-16 15:39  IT尘土  阅读(2949)  评论(0)    收藏  举报