Browse Source

Pull request #2290: 无JIRA任务 buttonGroup的layouts可以不用传数组

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '1ed9afaa22d94d2ed52faae19970a233774d7c26':
  buttonGroup的layouts可以不用传数组
es6
guy 3 years ago
parent
commit
1e93a70dc7
  1. 11
      src/base/combination/group.button.js

11
src/base/combination/group.button.js

@ -77,11 +77,12 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_packageBtns: function (btns) {
var o = this.options;
for (var i = o.layouts.length - 1; i > 0; i--) {
var layouts = BI.isArray(o.layouts) ? o.layouts : [o.layouts];
for (var i = layouts.length - 1; i > 0; i--) {
btns = BI.map(btns, function (k, it) {
return BI.extend({}, o.layouts[i], {
return BI.extend({}, layouts[i], {
items: [
BI.extend({}, o.layouts[i].el, {
BI.extend({}, layouts[i].el, {
el: it
})
]
@ -108,7 +109,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
},
_packageLayout: function (items) {
var o = this.options, layout = BI.deepClone(o.layouts[0]);
var o = this.options, layout = BI.deepClone(BI.isArray(o.layouts) ? o.layouts[0] : o.layouts);
var lay = BI.formatEL(layout).el;
while (lay && lay.items && !BI.isEmpty(lay.items)) {
@ -121,7 +122,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
// 如果是一个简单的layout
_isSimpleLayout: function () {
var o = this.options;
return o.layouts.length === 1 && !BI.isArray(o.items[0]);
return BI.isArray(o.layouts) ? (o.layouts.length === 1 && !BI.isArray(o.items[0])) : true;
},
doBehavior: function () {

Loading…
Cancel
Save