实现手机号码中间四位显示为*号方法:
// 转换用户手机号
let telephone = this.data.telephone;
// 提取字符串某部分: 起始索引(开始位置),终止索引(结束位置)
telephone = telephone.substring(0,3) +'****'+ telephone.substring(7);
this.setData({
telephone,
})
效果图:
声明:如有侵权行为,联系本人。