Evan You 12 سال پیش
والد
کامیت
dde0bc8d41
1فایلهای تغییر یافته به همراه3 افزوده شده و 0 حذف شده
  1. 3 0
      src/observer/array-augmentations.js

+ 3 - 0
src/observer/array-augmentations.js

@@ -102,6 +102,9 @@ _.define(arrayAugmentations, '$set', function (index, val) {
  */
  */
 
 
 _.define(arrayAugmentations, '$remove', function (index) {
 _.define(arrayAugmentations, '$remove', function (index) {
+  if (typeof index !== 'number') {
+    index = this.indexOf(index)
+  }
   if (index > -1) {
   if (index > -1) {
     return this.splice(index, 1)[0]
     return this.splice(index, 1)[0]
   }
   }