فهرست منبع

fix array augmentation methods

Evan You 12 سال پیش
والد
کامیت
953fd1adb4
1فایلهای تغییر یافته به همراه4 افزوده شده و 5 حذف شده
  1. 4 5
      src/binding.js

+ 4 - 5
src/binding.js

@@ -70,13 +70,12 @@ function typeOf (obj) {
 var aproto = Array.prototype,
     arrayMutators = ['push','pop','shift','unshift','splice','sort','reverse'],
     arrayAugmentations = {
-        remove: function (scope) {
-            this.splice(scope.$index, 1)
+        remove: function (index) {
+            if (typeof index !== 'number') index = index.$index
+            this.splice(index, 1)
         },
         replace: function (index, data) {
-            if (typeof index !== 'number') {
-                index = index.$index
-            }
+            if (typeof index !== 'number') index = index.$index
             this.splice(index, 1, data)
         }
     }