diff --git a/changelog.md b/changelog.md index 15f54bde8..a9e6ffbc7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-11) +- 修复了Popover小屏幕上看不完整的问题 - 颜色选择器支持输入16进制颜色编号 - bi.textarea_editor支持气泡提示报错 diff --git a/src/base/layer/layer.popover.js b/src/base/layer/layer.popover.js index 2132d35a0..387d1ff4e 100644 --- a/src/base/layer/layer.popover.js +++ b/src/base/layer/layer.popover.js @@ -99,8 +99,8 @@ BI.Popover = BI.inherit(BI.Widget, { self.body = this; }, css: { - "max-height": c.MAX_HEIGHT - o.headerHeight - (o.footer ? o.footerHeight : 0) - c.BODY_TGAP, - "min-height": size.height, + "max-height": this._getSuitableBodyHeight(c.MAX_HEIGHT - o.headerHeight - (o.footer ? o.footerHeight : 0) - c.BODY_TGAP), + "min-height": this._getSuitableBodyHeight(size.height), }, items: [{ el: o.body, @@ -146,7 +146,7 @@ BI.Popover = BI.inherit(BI.Widget, { scrolly: false, } : { type: "bi.vtape", - height: size.height, + height: BI.clamp(size.height, 0, BI.Widget._renderEngine.createElement("body")[0].clientHeight), }); }, @@ -160,6 +160,12 @@ BI.Popover = BI.inherit(BI.Widget, { }); }, + _getSuitableBodyHeight: function (height) { + var o = this.options; + var c = this._constant; + return BI.clamp(height, 0, BI.Widget._renderEngine.createElement("body")[0].clientHeight - o.headerHeight - (o.footer ? o.footerHeight : 0) - c.BODY_TGAP); + }, + _calculateSize: function () { var o = this.options; var size = {};