Browse Source

feature: sticky布局

es6
guy 3 years ago
parent
commit
715181e8d3
  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