From 371707e7025f572d46da8a8c1934b4b741b2a114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Thu, 8 Jun 2023 11:57:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20tab=20=E5=B1=95=E5=BC=80?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/element.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/element.js b/src/modules/element.js index d9105281..54009565 100644 --- a/src/modules/element.js +++ b/src/modules/element.js @@ -52,7 +52,8 @@ layui.define('jquery', function(exports){ // call.hideTabMore(true); // 是否添加即切换 options.change && this.tabChange(filter, options.id); - call.tabAuto(options.change); + titElem.data('LAY_TAB_CHANGE', options.change); + call.tabAuto(options.change ? 'change' : null); return this; }; @@ -217,10 +218,14 @@ layui.define('jquery', function(exports){ // 响应式 if( title.prop('scrollWidth') > title.outerWidth() + 1 || - title.height() > title.find('li').eq(0).height() + title.height() > function(height){ + return height + height/2; + }(title.find('li').eq(0).height()) ){ // 若执行是来自于切换,则自动展开 - spread && title.addClass(MORE); + ( + spread === 'change' && title.data('LAY_TAB_CHANGE') + ) && title.addClass(MORE); if(title.find('.'+BAR)[0]) return; title.append(span);