feat(Sku): add sku message formatter test

This commit is contained in:
liuhaihong
2020-07-17 20:35:59 +08:00
committed by neverland
parent 5cce17ab4b
commit b1460ce42e
2 changed files with 45 additions and 1 deletions
+2 -1
View File
@@ -115,11 +115,12 @@ export default createComponent({
* The phone number copied from IOS mobile phone address book
* will add spaces and invisible Unicode characters
* which cannot pass the /^\d+$/ verification
* so keep numbers and dots
*/
getFormatter(message) {
return function formatter(value) {
if (message.type === 'mobile' || message.type === 'tel') {
return value.replace(/\s/g, '').replace(/[\u202c|\u202d]/g, '');
return value.replace(/[^\d.]/g, '');
}
return value;