transform(val: string): string { if (!val) return ''; if (val.length === 11) { return val.replace(/(\d{3})(\d{4})(\d{4})/, (m, m1, m2, m3) => { return [m1, m2, m3].join('-'); }); } return val; }
Angular管道将手机号转换成xxx-xxxx-xxxx格式
最新推荐文章于 2019-03-29 11:42:05 发布