使用some()方法可以对数组进行遍历并设立对应的判断式,当满足判断时,会立即停止遍历并返回true、
const hasEmptyQuantity = this.dataForm.subBatchList.some(item =>
item.quantity === null || item.quantity === undefined || item.quantity === ''
);
if (hasEmptyQuantity) {
return this.$message.error("请填写所有数量");
}
使用some()方法可以对数组进行遍历并设立对应的判断式,当满足判断时,会立即停止遍历并返回true、
const hasEmptyQuantity = this.dataForm.subBatchList.some(item =>
item.quantity === null || item.quantity === undefined || item.quantity === ''
);
if (hasEmptyQuantity) {
return this.$message.error("请填写所有数量");
}
每一个童年的梦想都值得用青春去捍卫!