From 3bd163e762bee6f00283f1296d59357aa9417cee Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 6 Jun 2023 10:48:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20chore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/config.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index 66440ccf8..3c13020a2 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -5,7 +5,7 @@ // 1、支持flex的浏览器下使用flex布局 // 2、不支持flex的浏览器下使用inline布局 // 3、当列宽既需要自动列宽又需要自适应列宽时,inline布局也处理不了了。当横向出滚动条时使用table布局,不出滚动条时使用float布局 - var _isSupportFlex, _isSupportGrid; + var _isSupportFlex, _isSupportGrid, _isSupportSticky; var isSupportFlex = function () { if (_isSupportFlex == null) { _isSupportFlex = !!(BI.isSupportCss3 && BI.isSupportCss3("flex")); @@ -18,8 +18,7 @@ } return _isSupportGrid; }; - // 判断浏览器是否支持sticky 属性 - var isSupportSticky = (function () { + var innerSupportSticky = function () { var vendorList = ["", "-webkit-", "-ms-", "-moz-", "-o-"], vendorListLength = vendorList.length, stickyElement = document.createElement("div"); @@ -30,7 +29,14 @@ } } return false; - })(); + }; + // 判断浏览器是否支持sticky 属性 + var isSupportSticky = function () { + if (_isSupportSticky == null) { + _isSupportSticky = innerSupportSticky(); + } + return _isSupportSticky; + }; BI.Plugin.configWidget("bi.horizontal", function (ob) { var supportFlex = isSupportFlex(); // // 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况)