diff --git a/demo/js/core/popup/demo.popover.js b/demo/js/core/popup/demo.popover.js index 82a5e4a9d..1c736c34e 100644 --- a/demo/js/core/popup/demo.popover.js +++ b/demo/js/core/popup/demo.popover.js @@ -189,6 +189,10 @@ Demo.Func = BI.inherit(BI.Widget, { }; }), }, + footer: { + type: "bi.label", + text: "这个是footer", + }, }).open(id); }, }], diff --git a/src/base/layer/layer.popover.js b/src/base/layer/layer.popover.js index d20167539..8de34fe25 100644 --- a/src/base/layer/layer.popover.js +++ b/src/base/layer/layer.popover.js @@ -10,6 +10,9 @@ BI.Popover = BI.inherit(BI.Widget, { NORMAL: "normal", BIG: "big", }, + MAX_HEIGHT: 600, + BODY_TGAP: 10, + BODY_HGAP: 20, }, props: { @@ -17,7 +20,6 @@ BI.Popover = BI.inherit(BI.Widget, { size: "normal", // small, normal, big logic: { dynamic: false, - maxHeight: 600, }, header: null, headerHeight: 40, @@ -29,6 +31,7 @@ BI.Popover = BI.inherit(BI.Widget, { render: function () { var self = this; var o = this.options; + var c = this._constant; this.startX = 0; this.startY = 0; var size = this._calculateSize(); @@ -87,28 +90,32 @@ BI.Popover = BI.inherit(BI.Widget, { height: o.headerHeight, }, height: o.headerHeight, - }, { - el: o.logic.dynamic ? { + }, o.logic.dynamic ? { + el: { type: "bi.vertical", - scrolly: false, + scrolly: true, cls: "popover-body", ref: function () { self.body = this; }, - hgap: 20, - tgap: 10, + css: { + "max-height": c.MAX_HEIGHT - o.headerHeight - (o.footer ? o.footerHeight : 0) - c.BODY_TGAP - 2, + "min-height": size.height, + }, items: [{ - el: BI.extend({}, o.body, { - extraCls: "dynamic-height-limit-layout-" + size.type, - }), + el: o.body, }], - } : { + }, + hgap: c.BODY_HGAP, + tgap: c.BODY_TGAP, + } : { + el: { type: "bi.absolute", items: [{ el: o.body, - left: 20, - top: 10, - right: 20, + left: c.BODY_HGAP, + top: c.BODY_TGAP, + right: c.BODY_HGAP, bottom: 0, }], }, @@ -139,7 +146,7 @@ BI.Popover = BI.inherit(BI.Widget, { scrolly: false, } : { type: "bi.vtape", - height: size.height, + height: size.height - 2, }); }, diff --git a/src/less/base/layer/layer.popover.less b/src/less/base/layer/layer.popover.less deleted file mode 100644 index 6d038aeb4..000000000 --- a/src/less/base/layer/layer.popover.less +++ /dev/null @@ -1,13 +0,0 @@ -@maxHeight: 600px; - -.bi-popover { - .dynamic-height-limit-layout-small { - min-height: 200px; - max-height: @maxHeight; - } - - .dynamic-height-limit-layout-big, .dynamic-height-limit-layout-default { - min-height: 500px; - max-height: @maxHeight; - } -}