Browse Source

优化for循环写法

suntg 8 years ago
parent
commit
a4c2b51445

+ 4 - 5
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_deliveryRule_add_ctrl.js

@@ -298,11 +298,10 @@ define([ 'app/app' ], function(app) {
 
         $scope.containsArea = function (value) {
             var k = false;
-            angular.forEach($scope.qtyAreaArray, function (item) {
-                if (value == item){
-                    k = true;
-                }
-            });
+            for(const i in $scope.qtyAreaArray) {
+                var p = $scope.qtyAreaArray[i];
+                if (value == p) k = true; break;
+            }
             return k;
         };