mirror of
https://gitee.com/layui/layui.git
synced 2025-05-03 20:28:00 +08:00
优化 tab
中的获取下标的逻辑
This commit is contained in:
parent
419fc8da27
commit
9f20b0f441
@ -110,19 +110,25 @@ layui.define('jquery', function(exports){
|
|||||||
|
|
||||||
// 基础事件体
|
// 基础事件体
|
||||||
var call = {
|
var call = {
|
||||||
//Tab 点击
|
// Tab 点击
|
||||||
tabClick: function(e, index, liElem, options){
|
tabClick: function(e, index, liElem, options){
|
||||||
options = options || {};
|
options = options || {};
|
||||||
index = index === undefined
|
|
||||||
? othis.parent().children('li').index(othis)
|
|
||||||
: index;
|
|
||||||
var othis = liElem || $(this);
|
var othis = liElem || $(this);
|
||||||
var parents = options.headerElem ? othis.parent() : othis.parents('.layui-tab').eq(0);
|
var parents = options.headerElem
|
||||||
var item = options.bodyElem ? $(options.bodyElem) : parents.children('.layui-tab-content').children('.layui-tab-item');
|
? othis.parent()
|
||||||
|
: othis.parents('.layui-tab').eq(0);
|
||||||
|
var item = options.bodyElem
|
||||||
|
? $(options.bodyElem)
|
||||||
|
: parents.children('.layui-tab-content').children('.layui-tab-item');
|
||||||
var elemA = othis.find('a');
|
var elemA = othis.find('a');
|
||||||
var isJump = elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank'; //是否存在跳转
|
var isJump = elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank'; //是否存在跳转
|
||||||
var unselect = typeof othis.attr('lay-unselect') === 'string'; //是否禁用选中
|
var unselect = typeof othis.attr('lay-unselect') === 'string'; //是否禁用选中
|
||||||
var filter = parents.attr('lay-filter');
|
var filter = parents.attr('lay-filter');
|
||||||
|
|
||||||
|
// 下标
|
||||||
|
index = index === undefined
|
||||||
|
? othis.parent().children('li').index(othis)
|
||||||
|
: index;
|
||||||
|
|
||||||
//执行切换
|
//执行切换
|
||||||
if(!(isJump || unselect)){
|
if(!(isJump || unselect)){
|
||||||
|
Loading…
Reference in New Issue
Block a user