我试图使字段成为有条件的必填项,但是,当字段值位于对象数组中时,我很难访问它。 this.field
返回未定义。基本上,我想做的是检查classes.$.active
字段是否为false。如果为假,我想将monday
字段设置为false。如果我可以成功检查active
的值,则可以进行其余工作。
classes: {
type: Array,
optional: true,
},
'classes.$': {
type: Object,
optional: true,
},
'classes.$.monday': {
type: Boolean,
optional: true,
custom() {
console.log('test', this.field('classes.$.active').value);
},
}