Compare commits
2 Commits
8ff10a0915
...
58e25b7759
Author | SHA1 | Date | |
---|---|---|---|
|
58e25b7759 | ||
|
970412b736 |
|
@ -11,5 +11,8 @@ export const rules = {
|
|||
},
|
||||
price: value => {
|
||||
return (typeof value == 'number' || typeof value == 'undefined' || value === null) || 'Стоимость должна быть числом';
|
||||
},
|
||||
isNumber: value => {
|
||||
return /^\d+[\.,\,]?\d*$/.test(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ export default {
|
|||
if (this.price == ''){
|
||||
this.price = null;
|
||||
}
|
||||
if (typeof this.price == 'string' && /^\d+[\.,\,]?\d+$/.test(this.price)){
|
||||
if (typeof this.price == 'string' && rules.isNumber(this.price)){
|
||||
this.price = parseFloat(this.price)
|
||||
}
|
||||
let validateName = rules.notNull(this.name);
|
||||
|
|
|
@ -35,7 +35,7 @@ export default {
|
|||
if (this.price == ""){
|
||||
this.price = null;
|
||||
}
|
||||
if (typeof this.price == 'string' && /^\d+[\.,\,]?\d+$/.test(this.price)){
|
||||
if (typeof this.price == 'string' && rules.isNumber(this.price)){
|
||||
this.price = parseFloat(this.price)
|
||||
}
|
||||
let validateId = rules.id(this.wish_id);
|
||||
|
|
Loading…
Reference in New Issue