Browse Source

Fix/ie problem (#4444)

* Fixed IE search bug when setting showSearchButton

* Fix IE11 cannot work bug
文翼 6 years ago
parent
commit
c140bb7215
3 changed files with 21 additions and 26 deletions
  1. 2 1
      .eslintrc.js
  2. 15 15
      package.json
  3. 4 10
      src/bootstrap-table.js

+ 2 - 1
.eslintrc.js

@@ -64,7 +64,8 @@ module.exports = {
     'no-useless-constructor': 'warn',
     'no-useless-constructor': 'warn',
     'comma-dangle': ['error', 'never'],
     'comma-dangle': ['error', 'never'],
     'no-param-reassign': 'off',
     'no-param-reassign': 'off',
-    'space-before-function-paren': ["error", "always"]
+    'space-before-function-paren': ["error", "always"],
+    'no-prototype-builtins': 'off'
   },
   },
   'globals': {
   'globals': {
     '$': true,
     '$': true,

+ 15 - 15
package.json

@@ -7,29 +7,29 @@
     "doc": "site"
     "doc": "site"
   },
   },
   "devDependencies": {
   "devDependencies": {
-    "@babel/core": "^7.4.3",
-    "@babel/preset-env": "^7.4.3",
-    "core-js": "^3.0.0",
+    "@babel/core": "^7.4.5",
+    "@babel/preset-env": "^7.4.5",
+    "chalk": "^2.4.2",
+    "core-js": "^3.1.4",
     "cssmin-cli": "^0.0.5",
     "cssmin-cli": "^0.0.5",
-    "eslint": "^4.19.1",
-    "glob": "^7.1.3",
+    "eslint": "^6.0.0",
+    "esm": "^3.2.25",
+    "glob": "^7.1.4",
     "headr": "^0.0.4",
     "headr": "^0.0.4",
     "npm-run-all": "^4.1.5",
     "npm-run-all": "^4.1.5",
-    "rollup": "^1.8.0",
-    "rollup-plugin-babel": "^4.3.2",
+    "rollup": "^1.16.2",
+    "rollup-plugin-babel": "^4.3.3",
     "rollup-plugin-babel-minify": "^8.0.0",
     "rollup-plugin-babel-minify": "^8.0.0",
-    "rollup-plugin-commonjs": "^9.3.4",
-    "rollup-plugin-inject": "^2.2.0",
+    "rollup-plugin-commonjs": "^10.0.0",
+    "rollup-plugin-inject": "^3.0.0",
     "rollup-plugin-multi-entry": "^2.1.0",
     "rollup-plugin-multi-entry": "^2.1.0",
-    "rollup-plugin-node-resolve": "^4.0.1",
+    "rollup-plugin-node-resolve": "^5.0.4",
     "rollup-plugin-vue": "^5.0.0",
     "rollup-plugin-vue": "^5.0.0",
-    "sass": "^1.16.1",
+    "safe-eval": "^0.4.1",
+    "sass": "^1.21.0",
     "stylelint": "^10.1.0",
     "stylelint": "^10.1.0",
     "stylelint-config-standard": "^18.3.0",
     "stylelint-config-standard": "^18.3.0",
-    "vue-template-compiler": "^2.6.10",
-    "chalk": "^2.4.2",
-    "esm": "^3.2.25",
-    "safe-eval": "^0.4.1"
+    "vue-template-compiler": "^2.6.10"
   },
   },
   "scripts": {
   "scripts": {
     "lint:js": "eslint src",
     "lint:js": "eslint src",

+ 4 - 10
src/bootstrap-table.js

@@ -643,7 +643,10 @@ class BootstrapTable {
       this.$toolbar.append(html.join(''))
       this.$toolbar.append(html.join(''))
       const $searchInput = this.$toolbar.find('.search input')
       const $searchInput = this.$toolbar.find('.search input')
       $search = o.showSearchButton ? this.$toolbar.find('.search button[name=search]') : $searchInput
       $search = o.showSearchButton ? this.$toolbar.find('.search button[name=search]') : $searchInput
-      const eventTriggers = o.showSearchButton ? 'click' : 'keyup drop blur'
+
+      const eventTriggers = o.showSearchButton ? 'click' :
+        (Utils.isIEBrowser() ? 'mouseup' : 'keyup drop blur')
+
       $search.off(eventTriggers).on(eventTriggers, event => {
       $search.off(eventTriggers).on(eventTriggers, event => {
         if (o.searchOnEnterKey && event.keyCode !== 13) {
         if (o.searchOnEnterKey && event.keyCode !== 13) {
           return
           return
@@ -665,15 +668,6 @@ class BootstrapTable {
           this.onSearch({currentTarget: this.$toolbar.find('.search input')})
           this.onSearch({currentTarget: this.$toolbar.find('.search input')})
         })
         })
       }
       }
-
-      if (Utils.isIEBrowser()) {
-        $search.off('mouseup').on('mouseup', event => {
-          clearTimeout(timeoutId) // doesn't matter if it's 0
-          timeoutId = setTimeout(() => {
-            this.onSearch(event)
-          }, o.searchTimeOut)
-        })
-      }
     }
     }
   }
   }