mirror of https://github.com/layui/layui
优化 `tab` 中的获取下标的逻辑
parent
93159bbb68
commit
419fc8da27
|
@ -113,14 +113,16 @@ layui.define('jquery', function(exports){
|
||||||
//Tab 点击
|
//Tab 点击
|
||||||
tabClick: function(e, index, liElem, options){
|
tabClick: function(e, index, liElem, options){
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var othis = liElem || $(this)
|
index = index === undefined
|
||||||
,index = index || othis.parent().children('li').index(othis)
|
? othis.parent().children('li').index(othis)
|
||||||
,parents = options.headerElem ? othis.parent() : othis.parents('.layui-tab').eq(0)
|
: index;
|
||||||
,item = options.bodyElem ? $(options.bodyElem) : parents.children('.layui-tab-content').children('.layui-tab-item')
|
var othis = liElem || $(this);
|
||||||
,elemA = othis.find('a')
|
var parents = options.headerElem ? othis.parent() : othis.parents('.layui-tab').eq(0);
|
||||||
,isJump = elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank' //是否存在跳转
|
var item = options.bodyElem ? $(options.bodyElem) : parents.children('.layui-tab-content').children('.layui-tab-item');
|
||||||
,unselect = typeof othis.attr('lay-unselect') === 'string' //是否禁用选中
|
var elemA = othis.find('a');
|
||||||
,filter = parents.attr('lay-filter');
|
var isJump = elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank'; //是否存在跳转
|
||||||
|
var unselect = typeof othis.attr('lay-unselect') === 'string'; //是否禁用选中
|
||||||
|
var filter = parents.attr('lay-filter');
|
||||||
|
|
||||||
//执行切换
|
//执行切换
|
||||||
if(!(isJump || unselect)){
|
if(!(isJump || unselect)){
|
||||||
|
@ -177,8 +179,8 @@ layui.define('jquery', function(exports){
|
||||||
call.hideTabMore(true)
|
call.hideTabMore(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
//允许关闭
|
// 开启关闭图标
|
||||||
if(othis.attr('lay-allowClose')){
|
if(othis.attr('lay-allowclose')){
|
||||||
title.find('li').each(function(){
|
title.find('li').each(function(){
|
||||||
var li = $(this);
|
var li = $(this);
|
||||||
if(!li.find('.'+CLOSE)[0]){
|
if(!li.find('.'+CLOSE)[0]){
|
||||||
|
|
Loading…
Reference in New Issue