浏览代码

Check if the buttons option returned an array of buttons

Dustin Utecht 5 年之前
父节点
当前提交
1fc9eba98a
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/bootstrap-table.js

+ 4 - 1
src/bootstrap-table.js

@@ -46,7 +46,10 @@ class BootstrapTable {
       Utils.sprintf(`${buttonsPrefix}%s`, opts.iconSize)
     ].join(' ').trim()
 
-    this.buttons = Utils.calculateObjectValue(this, opts.buttons, [], [])
+    this.buttons = Utils.calculateObjectValue(this, opts.buttons, [], {})
+    if (typeof this.buttons !== 'object') {
+      this.buttons = {}
+    }
   }
 
   initLocale () {