Skip to content

Commit

Permalink
fixed: 支持手机号以 16 开头校验
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanceYu committed Apr 15, 2020
1 parent ba05631 commit ec22f74
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
## Released


### [v2.1.11](https://github.com/ChanceYu/we-validator/releases/tag/v2.2.0)
- 修复:手机号以 `16` 开头的校验问题[issue](https://github.com/ChanceYu/we-validator/issues/12)


### [v2.1.10](https://github.com/ChanceYu/we-validator/releases/tag/v2.1.10)
- 新增:`.checkFields` 方法,可校验对应的字段,[参考](./README.md#checkfieldsdata-fields-onmessage)
- 修改:`.isValid` 方法,可校验对应的字段,[参考](./README.md#isvaliddata-fields)
Expand Down
8 changes: 4 additions & 4 deletions dist/we-validator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* we-validator
* version: 2.1.10
* version: 2.1.11
* address: https://github.com/ChanceYu/we-validator#readme
* author: ChanceYu <i.fish@foxmail.com>
* license: MIT
Expand Down Expand Up @@ -105,7 +105,7 @@ var requiredFn = _rules2.default.required.rule;
var isWx = typeof wx !== 'undefined' && !!wx.showToast; // 微信小程序
var isMy = typeof my !== 'undefined' && !!my.showToast; // 支付宝小程序
var isSwan = typeof swan !== 'undefined' && !!swan.showToast; // 百度智能小程序
var isTt = typeof tt !== 'undefined' && !!tt.showToast; // 头条小程序
var isTt = typeof tt !== 'undefined' && !!tt.showToast; // 字节跳动小程序
var isBrowser = typeof window !== 'undefined' && !!window.alert; // 普通浏览器

var objString = Object.prototype.toString;
Expand Down Expand Up @@ -213,7 +213,7 @@ var WeValidator = function () {
});
}

// 头条小程序
// 字节跳动小程序
if (isTt) {
return tt.showToast({
title: params.msg,
Expand Down Expand Up @@ -543,7 +543,7 @@ module.exports = {
*/
mobile: {
message: '请输入11位的手机号码',
rule: /^1[345789]\d{9}$/
rule: /^1[3456789]\d{9}$/
},
/**
* 座机号,例如:010-1234567、0551-1234567
Expand Down
4 changes: 2 additions & 2 deletions dist/we-validator.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions example/wechat/js/we-validator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* we-validator
* version: 2.1.10
* version: 2.1.11
* address: https://github.com/ChanceYu/we-validator#readme
* author: ChanceYu <i.fish@foxmail.com>
* license: MIT
Expand Down Expand Up @@ -105,7 +105,7 @@ var requiredFn = _rules2.default.required.rule;
var isWx = typeof wx !== 'undefined' && !!wx.showToast; // 微信小程序
var isMy = typeof my !== 'undefined' && !!my.showToast; // 支付宝小程序
var isSwan = typeof swan !== 'undefined' && !!swan.showToast; // 百度智能小程序
var isTt = typeof tt !== 'undefined' && !!tt.showToast; // 头条小程序
var isTt = typeof tt !== 'undefined' && !!tt.showToast; // 字节跳动小程序
var isBrowser = typeof window !== 'undefined' && !!window.alert; // 普通浏览器

var objString = Object.prototype.toString;
Expand Down Expand Up @@ -213,7 +213,7 @@ var WeValidator = function () {
});
}

// 头条小程序
// 字节跳动小程序
if (isTt) {
return tt.showToast({
title: params.msg,
Expand Down Expand Up @@ -543,7 +543,7 @@ module.exports = {
*/
mobile: {
message: '请输入11位的手机号码',
rule: /^1[345789]\d{9}$/
rule: /^1[3456789]\d{9}$/
},
/**
* 座机号,例如:010-1234567、0551-1234567
Expand Down
8 changes: 4 additions & 4 deletions lib/we-validator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* we-validator
* version: 2.1.10
* version: 2.1.11
* address: https://github.com/ChanceYu/we-validator#readme
* author: ChanceYu <i.fish@foxmail.com>
* license: MIT
Expand Down Expand Up @@ -105,7 +105,7 @@ var requiredFn = _rules2.default.required.rule;
var isWx = typeof wx !== 'undefined' && !!wx.showToast; // 微信小程序
var isMy = typeof my !== 'undefined' && !!my.showToast; // 支付宝小程序
var isSwan = typeof swan !== 'undefined' && !!swan.showToast; // 百度智能小程序
var isTt = typeof tt !== 'undefined' && !!tt.showToast; // 头条小程序
var isTt = typeof tt !== 'undefined' && !!tt.showToast; // 字节跳动小程序
var isBrowser = typeof window !== 'undefined' && !!window.alert; // 普通浏览器

var objString = Object.prototype.toString;
Expand Down Expand Up @@ -213,7 +213,7 @@ var WeValidator = function () {
});
}

// 头条小程序
// 字节跳动小程序
if (isTt) {
return tt.showToast({
title: params.msg,
Expand Down Expand Up @@ -543,7 +543,7 @@ module.exports = {
*/
mobile: {
message: '请输入11位的手机号码',
rule: /^1[345789]\d{9}$/
rule: /^1[3456789]\d{9}$/
},
/**
* 座机号,例如:010-1234567、0551-1234567
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "we-validator",
"version": "2.1.10",
"version": "2.1.11",
"description": "简单灵活的表单验证插件,支持小程序、浏览器、Nodejs",
"main": "lib/we-validator.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
*/
mobile: {
message: '请输入11位的手机号码',
rule: /^1[345789]\d{9}$/
rule: /^1[3456789]\d{9}$/
},
/**
* 座机号,例如:010-1234567、0551-1234567
Expand Down

0 comments on commit ec22f74

Please sign in to comment.