$scope.listSelect = function (param) {
if(param.selectedStatus){
$scope.all = true;
try{
$scope.floorPriceTable.forEach(function(value){
if(!value.selectedStatus){
console.log("try中遇到未选中的,要跳出程序");//
$scope.all = false;
foreach.break=new Error("StopIteration");
}
});
}catch(e){
if(e.message==="foreach is not defined") {
console.log("跳出forEach循环");//
return;
}else {
throw e
}
}
}else{
$scope.all = false
}
}
Javascript跳出当前的ForEach循环
最新推荐文章于 2024-03-07 16:28:00 发布