我需要根据元素本身的值来验证列表的元素。
是否有可能或者我应该为每个产品创建一个验证?
new Vue({
el: "#app",
data: {
text: '',
sons: [
{amount: 20, pending: 50},
{amount: 30, pending: 150}
]
},
validations: {
text: {
required,
minLength: minLength(5)
},
sons: {
minLength: 3,
$each: {
amount: {
maxValue: maxValue(this.sons[x].pending) // how to set x?
}
}
}
}
})