如何为嵌套字段设置'dependsOn'?
这不会起作用......
Model.add({
title: { type: String, required: true },
test1: { type: Boolean, default: false },
verify1: { type: String, dependsOn: { test1: false } },
nested: {
test2: { type: Boolean, default: false },
verify2: { type: String, dependsOn: { test2: false } },
}
});
答案 0 :(得分:2)
我尝试了一些事情。您不仅需要包含路径,还必须将其视为字符串。
这有效......
Model.add({
title: { type: String, required: true },
test1: { type: Boolean, default: false },
verify1: { type: String, dependsOn: { test1: false } },
nested: {
test2: { type: Boolean, default: false },
verify2: { type: String, dependsOn: { 'nested.test2': false } },
}
});