Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2022-12-22 11:28:32 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
79c96c283bdfa8ba323998bbe839f41e50e6e23b
79c96c28
1 parent
e430a0c4
fix
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
src/components/NumberField/index.vue
src/components/NumberField/index.vue
View file @
79c96c2
<!--
* @Date: 2022-09-14 14:44:30
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-12-2
1 18:24:37
* @LastEditTime: 2022-12-2
2 11:28:05
* @FilePath: /data-table/src/components/NumberField/index.vue
* @Description: 数字输入框
-->
...
...
@@ -135,11 +135,11 @@ const reg = new RegExp("^([0-9]+)(\\.(\\d){" + max_count +"," + max_count +"})$"
const validator = (val) => {
if (required && !val) { // 必填
return false;
} else if (min && (val < min)) { // 小于最小值
} else if (
val &&
min && (val < min)) { // 小于最小值
return false;
} else if (max && (val > max)) { // 大于最大值
} else if (
val &&
max && (val > max)) { // 大于最大值
return false;
} else if (max_count && !reg.test(val)) { // 不符合保留小数个数
} else if (
val &&
max_count && !reg.test(val)) { // 不符合保留小数个数
return false;
} else {
return true;
...
...
@@ -149,11 +149,11 @@ const validator = (val) => {
const validatorMessage = (val, rule) => {
if (required && !val) {
return "输入不能为空";
} else if (min && (val < min)) { // 小于最小值
} else if (
val &&
min && (val < min)) { // 小于最小值
return "最小值为" + min;
} else if (max && (val > max)) { // 大于最大值
} else if (
val &&
max && (val > max)) { // 大于最大值
return "最大值为" + max;
} else if (max_count && !reg.test(val)) { // 不符合保留小数个数
} else if (
val &&
max_count && !reg.test(val)) { // 不符合保留小数个数
return "保留小数点后" + max_count + "位";
}
};
...
...
Please
register
or
login
to post a comment