Browse Source

refactor: 调整下代码

es6
iapyang 4 years ago
parent
commit
ee1992c46e
  1. 5
      demo/js/core/popup/demo.popover.js
  2. 5
      src/base/layer/layer.popover.js

5
demo/js/core/popup/demo.popover.js

@ -169,14 +169,15 @@ Demo.Func = BI.inherit(BI.Widget, {
}, { }, {
type: "bi.text_button", type: "bi.text_button",
height: 30, height: 30,
text: "弹出一个高度动态的popover层, 此弹出层指定size为small, 但是高度随内容自适应,自适应支持的最大高度为600px", text: "弹出一个高度动态的popover层, 此弹出层指定size为small, 但是高度随内容自适应,自适应支持的最大高度为默认为600px",
handler: function() { handler: function() {
var id = "弹出层id1" var id = "弹出层id1"
BI.Popovers.create(id, { BI.Popovers.create(id, {
// String或者是json都行 // String或者是json都行
header: "弹出层标题", header: "弹出层标题",
logic: { logic: {
dynamic: true dynamic: true,
maxHeight: 700,
}, },
size: "small", size: "small",
body: { body: {

5
src/base/layer/layer.popover.js

@ -16,7 +16,8 @@ BI.Popover = BI.inherit(BI.Widget, {
baseCls: "bi-popover bi-card bi-border-radius", baseCls: "bi-popover bi-card bi-border-radius",
size: "normal", // small, normal, big size: "normal", // small, normal, big
logic: { logic: {
dynamic: false dynamic: false,
maxHeight: 600,
}, },
header: null, header: null,
headerHeight: 40, headerHeight: 40,
@ -155,7 +156,7 @@ BI.Popover = BI.inherit(BI.Widget, {
if (o.logic.dynamic) { if (o.logic.dynamic) {
var size = this._calculateSize(); var size = this._calculateSize();
var height = this.element.height(); var height = this.element.height();
var compareHeight = BI.clamp(height, size.height, 600) - (o.footer ? o.footerHeight + o.headerHeight : o.headerHeight); var compareHeight = BI.clamp(height, size.height, o.logic.maxHeight || 600) - (o.footer ? o.footerHeight + o.headerHeight : o.headerHeight);
this.body.element.height(compareHeight); this.body.element.height(compareHeight);
} }
}, },

Loading…
Cancel
Save