mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
fix(form): lint
This commit is contained in:
parent
b44901e111
commit
71ec0cb47a
@ -66,7 +66,7 @@ export default defineComponent({
|
|||||||
validateCallback?: FormValidateCallback,
|
validateCallback?: FormValidateCallback,
|
||||||
shouldRuleBeApplied: ApplyRule = () => true
|
shouldRuleBeApplied: ApplyRule = () => true
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
return await new Promise((resolve, reject) => {
|
||||||
const formItemValidationPromises = []
|
const formItemValidationPromises = []
|
||||||
for (const key of keysOf(formItems)) {
|
for (const key of keysOf(formItems)) {
|
||||||
const formItemInstances = formItems[key]
|
const formItemInstances = formItems[key]
|
||||||
|
@ -297,20 +297,20 @@ export default defineComponent({
|
|||||||
return shallowClonedRule
|
return shallowClonedRule
|
||||||
})
|
})
|
||||||
if (!activeRules.length) {
|
if (!activeRules.length) {
|
||||||
return Promise.resolve({
|
return await Promise.resolve({
|
||||||
valid: true
|
valid: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const mergedPath = path ?? '__n_no_path__'
|
const mergedPath = path ?? '__n_no_path__'
|
||||||
const validator = new Schema({ [mergedPath]: activeRules as RuleItem[] })
|
const validator = new Schema({ [mergedPath]: activeRules as RuleItem[] })
|
||||||
return new Promise((resolve) => {
|
return await new Promise((resolve) => {
|
||||||
void validator.validate(
|
void validator.validate(
|
||||||
{ [mergedPath]: value },
|
{ [mergedPath]: value },
|
||||||
options,
|
options,
|
||||||
(errors, fields) => {
|
(errors, fields) => {
|
||||||
if (errors?.length) {
|
if (errors?.length) {
|
||||||
explainsRef.value = errors.map(
|
explainsRef.value = errors.map(
|
||||||
(error: ValidateError) => error?.message ?? ''
|
(error: ValidateError) => error?.message || ''
|
||||||
)
|
)
|
||||||
validationErroredRef.value = true
|
validationErroredRef.value = true
|
||||||
resolve({
|
resolve({
|
||||||
|
Loading…
Reference in New Issue
Block a user