[Improvement] extract component common part (#703)

This commit is contained in:
neverland
2018-03-16 17:10:46 +08:00
committed by GitHub
parent f26ad3b912
commit ffd72e5442
81 changed files with 174 additions and 207 deletions
+10 -4
View File
@@ -2,18 +2,24 @@
* Create a component with common options
*/
import '../locale';
import Icon from '../icon';
import i18n from '../mixins/i18n';
import install from './install';
import Icon from '../icon';
import Loading from '../loading';
import Cell from '../cell';
import CellGroup from '../cell-group';
export default function(sfc) {
sfc.name = 'van-' + sfc.name;
sfc.install = sfc.install || install;
sfc.mixins = sfc.mixins || [];
sfc.mixins.push(i18n);
sfc.components = sfc.components || {};
sfc.components.icon = Icon;
sfc.components.loading = Loading;
sfc.components = Object.assign(sfc.components || {}, {
Icon,
Loading,
Cell,
CellGroup
});
return sfc;
};
+2 -2
View File
@@ -1,4 +1,4 @@
export default function mobile(value) {
return /^((\+86)|(86))?(1)\d{10}$/.test(value) ||
/^\+?(9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1|)-?\d{1,14}$/.test(String(value));
value = value.replace(/[^-|\d]/g, '');
return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9\-]{10,13}$/.test(value);
}