Commit 15ad0454 authored by qinhaitao's avatar qinhaitao

fix: 🐛 校验错误

parent e6e5fd18
...@@ -259,7 +259,7 @@ Component({ ...@@ -259,7 +259,7 @@ Component({
prizeInitData: { prizeInitData: {
...this.data.prizeInitData, ...this.data.prizeInitData,
switchStock: value, switchStock: value,
stock: value === 0 ? "" : this.data.prizeInitData.stock, stock: value === 2 ? "" : this.data.prizeInitData.stock,
}, },
}); });
}, },
......
...@@ -24,13 +24,14 @@ const validateParams = (validators: Rules, data: object) => { ...@@ -24,13 +24,14 @@ const validateParams = (validators: Rules, data: object) => {
const validator = new Schema(validators) const validator = new Schema(validators)
return new Promise(resolve => { return new Promise(resolve => {
validator validator.validate(data, {}, (errors, fields) => {
.validate(data) console.log('errors', errors)
.then(() => { console.log('fields', fields)
if (errors) {
resolve({}) resolve({})
}) } else {
.catch(({ errors, fields }) => {
resolve({ errors, fields }) resolve({ errors, fields })
}) }
})
}) })
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment