浏览代码

Fixed event binding if only one export type is set (#5942)

Co-authored-by: Dennis Hernández <dennishernandezvargas@gmail.com>
Dustin Utecht 4 年之前
父节点
当前提交
cab32d1b5b
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      src/extensions/export/bootstrap-table-export.js

+ 7 - 1
src/extensions/export/bootstrap-table-export.js

@@ -149,7 +149,13 @@ $.BootstrapTable = class extends $.BootstrapTable {
     }
 
     this.updateExportButton()
-    this.$export.find('[data-type]').click(e => {
+    let $exportButtons = this.$export.find('[data-type]')
+
+    if (exportTypes.length === 1) {
+      $exportButtons = this.$export.find('button')
+    }
+
+    $exportButtons.click(e => {
       e.preventDefault()
 
       const type = $(e.currentTarget).data('type')