Commit 15ad0454 authored by qinhaitao's avatar qinhaitao

fix: 🐛 校验错误

parent e6e5fd18
......@@ -259,7 +259,7 @@ Component({
prizeInitData: {
...this.data.prizeInitData,
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) => {
const validator = new Schema(validators)
return new Promise(resolve => {
validator
.validate(data)
.then(() => {
validator.validate(data, {}, (errors, fields) => {
console.log('errors', errors)
console.log('fields', fields)
if (errors) {
resolve({})
})
.catch(({ errors, fields }) => {
} else {
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