Browse Source

Fix #4098: Fixed IE11 transform bug

zhixin 6 years ago
parent
commit
8dac22f574
3 changed files with 10 additions and 2 deletions
  1. 5 0
      .babelrc
  2. 3 0
      package.json
  3. 2 2
      src/bootstrap-table.js

+ 5 - 0
.babelrc

@@ -5,6 +5,11 @@
     }],
     }],
     "stage-0",
     "stage-0",
   ],
   ],
+  "plugins": [
+    "array-includes",
+    ["transform-es2015-for-of", {"loose": true}],
+    "object-entries-and-values-to-object-keys"
+  ],
   "env": {
   "env": {
     "production": {
     "production": {
       "presets": ["babili"]
       "presets": ["babili"]

+ 3 - 0
package.json

@@ -8,6 +8,9 @@
   },
   },
   "devDependencies": {
   "devDependencies": {
     "babel-cli": "^6.26.0",
     "babel-cli": "^6.26.0",
+    "babel-plugin-array-includes": "^2.0.3",
+    "babel-plugin-object-entries-and-values-to-object-keys": "^1.0.1",
+    "babel-plugin-transform-es2015-for-of": "^6.23.0",
     "babel-preset-babili": "^0.1.4",
     "babel-preset-babili": "^0.1.4",
     "babel-preset-env": "^1.7.0",
     "babel-preset-env": "^1.7.0",
     "babel-preset-stage-0": "^6.24.1",
     "babel-preset-stage-0": "^6.24.1",

+ 2 - 2
src/bootstrap-table.js

@@ -259,9 +259,9 @@
     },
     },
 
 
     findIndex (items, item) {
     findIndex (items, item) {
-      for (const [i, it] of items.entries()) {
+      for (const it of items) {
         if (JSON.stringify(it) === JSON.stringify(item)) {
         if (JSON.stringify(it) === JSON.stringify(item)) {
-          return i
+          return items.indexOf(it)
         }
         }
       }
       }
       return -1
       return -1