我有
StartIntensity: yup.number(),
EndIntensity: yup
.number()
.when(
"StartIntensity",
(StartIntensity: number, schema: any) => {
return !!StartIntensity
? schema.moreThan(
StartIntensity,
"Max should be > min"
)
: schema;
}
),
但我需要这样的东西
StartIntensity: yup.number(),
EndIntensity: yup
.number()
.when(
"StartIntensity, EndIntensity",
(StartIntensity: number, EndIntensity: number, schema: any) => {
return !!StartIntensity && StartIntensity !== EndIntensity
? schema.moreThan(
StartIntensity,
"Max should be > min"
)
: schema;
}
),
但上面的代码不能正常工作。是否有可能以其他方式执行此验证?