Browse Source

KERNEL-13158: 优化下useContext,简单处理即可

es6
guy 2 years ago
parent
commit
6e3d59d8fb
  1. 8
      src/core/4.widget.js
  2. 4
      src/widget/date/calendar/popup.month.js

8
src/core/4.widget.js

@ -288,18 +288,14 @@
_initElementWidth: function () { _initElementWidth: function () {
var o = this.options; var o = this.options;
if (BI.isArray(o.width)) { if (BI.isWidthOrHeight(o.width)) {
this.element.css("width", BI.pixFormat(...o.width));
} else if (BI.isWidthOrHeight(o.width)) {
this.element.css("width", BI.isNumber(o.width) ? BI.pixFormat(o.width) : o.width); this.element.css("width", BI.isNumber(o.width) ? BI.pixFormat(o.width) : o.width);
} }
}, },
_initElementHeight: function () { _initElementHeight: function () {
var o = this.options; var o = this.options;
if (BI.isArray(o.height)) { if (BI.isWidthOrHeight(o.height)) {
this.element.css("height", BI.pixFormat(...o.height));
} else if (BI.isWidthOrHeight(o.height)) {
this.element.css("height", BI.isNumber(o.height) ? BI.pixFormat(o.height) : o.height); this.element.css("height", BI.isNumber(o.height) ? BI.pixFormat(o.height) : o.height);
} }
}, },

4
src/widget/date/calendar/popup.month.js

@ -49,6 +49,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
}, },
_getItems: function(m) { _getItems: function(m) {
BI.Widget.pushContext(this);
// 纵向排列月 // 纵向排列月
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
@ -67,7 +68,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
whiteSpace: "nowrap", whiteSpace: "nowrap",
once: false, once: false,
forceSelected: true, forceSelected: true,
height: [BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, 1], height: BI.pixFormat(BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, 1),
width: 30, width: 30,
value: td, value: td,
text: td, text: td,
@ -75,6 +76,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
}; };
}); });
}); });
BI.Widget.popContext();
return items; return items;
}, },

Loading…
Cancel
Save