Refactor function

This commit is contained in:
benguozakinci@gmail.com 2021-07-02 16:42:15 +03:00
parent 5148255dde
commit cfa3c2091d

View File

@ -55,16 +55,15 @@ const app = new Vue({
},
'form.purchase_price': function (newVal, oldVal) {
if (newVal != '' && newVal.search('^(?=.*?[0-9])[0-9.,]+$') == -1) {
if (newVal != '' && newVal.search('^(?=.*?[0-9])[0-9.,]+$') !== 0) {
this.form.purchase_price = oldVal;
return;
}
if (newVal.search('^(?=.*?[0-9])[0-9.,]+$') == 0) {
for (let item of this.regex_condition) {
if (this.form.purchase_price.includes(item)) {
this.splice_value = this.form.purchase_price.replace(item, '');
this.form.purchase_price = this.splice_value;
}
for (let item of this.regex_condition) {
if (this.form.purchase_price.includes(item)) {
this.splice_value = this.form.purchase_price.replace(item, '');
this.form.purchase_price = this.splice_value;
}
}
}