diff --git a/src/css/layui.css b/src/css/layui.css index f0c54bce..a16e8589 100644 --- a/src/css/layui.css +++ b/src/css/layui.css @@ -1317,6 +1317,7 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh .layui-tabs-header li .layui-tabs-close{position: relative; display: inline-block; width: 16px; height: 16px; line-height: 18px; margin-left: 8px; top: 0px; text-align: center; font-size: 12px; color: #959595; border-radius: 50%; font-weight: 700; transition: all .16s; -webkit-transition: all .16s;} .layui-tabs-header li .layui-tabs-close:hover{ background-color: #ff5722; color: #fff;} +.layui-tabs-header li[lay-closable="false"] .layui-tabs-close{display: none;} .layui-tabs-body{padding: 16px 0;} .layui-tabs-item{display: none;} diff --git a/src/modules/tabs.js b/src/modules/tabs.js index 4c1ab889..b34802a0 100644 --- a/src/modules/tabs.js +++ b/src/modules/tabs.js @@ -459,7 +459,7 @@ layui.define('component', function(exports) { var that = this var options = that.config; - if(!options.closable) return; + if (!options.closable) return; opts = opts || {}; @@ -484,17 +484,13 @@ layui.define('component', function(exports) { var that = this; var options = that.config; var container = that.getContainer(); - var hasDel = that.cache('close'); // 是否开启关闭 if (options.closable) { - if (!hasDel) { - container.header.items.each(function(){ - that.appendClose($(this)); - }); - that.cache('close', true); - } - } else if(hasDel) { + container.header.items.each(function() { + that.appendClose($(this)); + }); + } else { container.header.items.each(function() { $(this).find('.'+ component.CONST.CLOSE).remove(); });