实现手机号码中间四位显示为*号方法:
substring使用方法:
开始位置,结束位置(不包括结束)
下面的示例就是 截取0到3不包含3,中间4个*,从第7开始截取到最后
// 转换用户手机号
let telephone = this.data.telephone;
// 提取字符串某部分: 起始索引(开始位置),终止索引(结束位置)
telephone = telephone.substring(0,3) +'****'+ telephone.substring(7);
this.setData({
telephone,
})
在项目中用到的:
{{bizEquipmentInfo.lastUnlockingVO?.mobile.substring(0,3) + '****' + bizEquipmentInfo.lastUnlockingVO?.mobile.substring(7)? bizEquipmentInfo.lastUnlockingVO?.mobile.substring(0,3) + '****' + bizEquipmentInfo.lastUnlockingVO?.mobile.substring(7) : '获取中...' }}
![]()



![[C++随想录] 继承](https://img-blog.csdnimg.cn/40a7d59d8b9d4e298b509dbe25292f83.png)

![2023年中国玉米淀粉糖市场现状及行业需求前景分析[图]](https://img-blog.csdnimg.cn/img_convert/57d13f8f90fe0ac100a4c1f50913eebe.png)













