...
|
...
|
@@ -183,8 +183,31 @@ function tabInit() { |
|
|
var tabs = $this.find('a.anchor');
|
|
|
var curTab = $this.find('a.anchor.active').attr('tab');
|
|
|
|
|
|
store.tab.tabs = tabs;
|
|
|
if ($this.hasClass('tab-fix')) {
|
|
|
store.tab.tabs = tabs;
|
|
|
}
|
|
|
|
|
|
let tabnames = tabs.map(function(i, el) {
|
|
|
return $(el).attr('tab');
|
|
|
}).get();
|
|
|
|
|
|
// 初始化选择状态
|
|
|
$('div[tabname]').each(function(index, el) {
|
|
|
let $el = $(el);
|
|
|
let tname = $el.attr('tabname');
|
|
|
|
|
|
if (!tabnames.includes(tname)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ($el.attr('tabname') === curTab) {
|
|
|
$el.show();
|
|
|
} else {
|
|
|
$el.hide();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 绑定单击事件
|
|
|
tabs.on('click', function() {
|
|
|
var tab = $(this);
|
|
|
var tabname = tab.attr('tab');
|
...
|
...
|
@@ -201,25 +224,19 @@ function tabInit() { |
|
|
|
|
|
$('div[tabname]').each(function(index, el) {
|
|
|
let $el = $(el);
|
|
|
let tname = $el.attr('tabname');
|
|
|
|
|
|
if ($el.attr('tabname') === tabname) {
|
|
|
if (!tabnames.includes(tname)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (tname === tabname) {
|
|
|
$el.show();
|
|
|
} else {
|
|
|
$el.hide();
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
$('div[tabname]').each(function(index, el) {
|
|
|
let $el = $(el);
|
|
|
|
|
|
if ($el.attr('tabname') === curTab) {
|
|
|
$el.show();
|
|
|
} else {
|
|
|
$el.hide();
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
|