From 715181e8d30cfe29e1e665281d5db9c41e87ec4a Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 17 Feb 2022 22:45:08 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20sticky=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/config.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index 2aedd70c0..5770bcb3b 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -12,6 +12,19 @@ BI.prepares.push(function () { } 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) { var supportFlex = isSupportFlex(); // // 在横向自适应场景下我们需要使用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) { if (isSupportFlex()) {