Browse Source

Pull request #2490: 无JIRA任务 feature: sticky布局

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

* commit '760e7c0bc9a05d118a4fc56c20c5638e5db82529':
  feature: sticky布局
  feature: sticky布局
es6
guy 3 years ago
parent
commit
56bf67974c
  1. 23
      src/core/platform/web/config.js

23
src/core/platform/web/config.js

@ -12,6 +12,19 @@ BI.prepares.push(function () {
} }
return _isSupportFlex; return _isSupportFlex;
}; };
// 判断浏览器是否支持sticky 属性
var isSupportSticky = (function () {
var vendorList = ["", "-webkit-", "-ms-", "-moz-", "-o-"],
vendorListLength = vendorList.length,
stickyElement = document.createElement("div");
for (var i = 0; i < vendorListLength; i++) {
stickyElement.style.position = vendorList[i] + "sticky";
if (stickyElement.style.position !== "") {
return true;
}
}
return false;
})();
BI.Plugin.configWidget("bi.horizontal", function (ob) { BI.Plugin.configWidget("bi.horizontal", function (ob) {
var supportFlex = isSupportFlex(); var supportFlex = isSupportFlex();
// // 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况) // // 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况)
@ -150,6 +163,16 @@ BI.prepares.push(function () {
}) })
}); });
}); });
BI.Plugin.configWidget("bi.horizontal_sticky", function (ob) {
if (!isSupportSticky) {
return BI.extend({}, ob, {type: "bi.horizontal_fill"});
}
});
BI.Plugin.configWidget("bi.vertical_sticky", function (ob) {
if (!isSupportSticky) {
return BI.extend({}, ob, {type: "bi.vertical_fill"});
}
});
BI.Plugin.configWidget("bi.left_right_vertical_adapt", function (ob) { BI.Plugin.configWidget("bi.left_right_vertical_adapt", function (ob) {
if (isSupportFlex()) { if (isSupportFlex()) {

Loading…
Cancel
Save