浏览代码

Support buttons.xyz.attributes.class

Marcel Overdijk 2 年之前
父节点
当前提交
044c892d1c
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      src/bootstrap-table.js

+ 5 - 1
src/bootstrap-table.js

@@ -746,7 +746,11 @@ class BootstrapTable {
           buttonHtml = buttonConfig.html
         }
       } else {
-        buttonHtml = `<button class="${this.constants.buttonsClass}" type="button" name="${buttonName}"`
+        if (buttonConfig.hasOwnProperty('attributes')) {
+          let buttonClass = buttonConfig.attributes.class || ''
+        }
+        buttonClass += ` ${this.constants.buttonsClass}`
+        buttonHtml = `<button class="${buttonClass}" type="button" name="${buttonName}"`
 
         if (buttonConfig.hasOwnProperty('attributes')) {
           for (const [attributeName, value] of Object.entries(buttonConfig.attributes)) {