|
|
@@ -482,15 +482,26 @@ if (typeof jQuery === "undefined") {
|
|
|
* close others tab
|
|
|
* @return self Chain structure.
|
|
|
*/
|
|
|
- closeOthers: function () {
|
|
|
+ closeOthers: function (retainTab) {
|
|
|
var self = this,
|
|
|
- $el = self.$element;
|
|
|
- $el.navPanelList.find('li:not(.active)').find('a:not([data-type="main"])').each(function () {
|
|
|
+ $el = self.$element,
|
|
|
+ findTab;
|
|
|
+
|
|
|
+ if (!retainTab) {
|
|
|
+ findTab = $el.navPanelList.find('li:not(.active)').find('a:not([data-type="main"])');
|
|
|
+ } else {
|
|
|
+ findTab = $el.navPanelList.find('a:not([data-type="main"])').filter(function(index){
|
|
|
+ if (retainTab != $(this).data('index')) return this;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ findTab.each(function () {
|
|
|
var $navTab = $(this);
|
|
|
self._delStorage($navTab.attr('data-id')); //remove tab from session storage
|
|
|
self._getTabPane($navTab).remove(); //remove tab-content
|
|
|
$navTab.parent('li').remove(); //remove navtab
|
|
|
});
|
|
|
+ retainTab && self.active($el.navPanelList.find('a[data-index="' + retainTab + '"]'));
|
|
|
$el.navPanelList.css("margin-left", "0");
|
|
|
return self;
|
|
|
},
|
|
|
@@ -700,6 +711,14 @@ if (typeof jQuery === "undefined") {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ menuData.push(
|
|
|
+ {text: '关闭其他', onclick: function(){
|
|
|
+ self.closeOthers($navTab.data('index'));
|
|
|
+ menu.hide();
|
|
|
+ return false;
|
|
|
+ }}
|
|
|
+ );
|
|
|
+
|
|
|
var l = menuData.length, i;
|
|
|
|
|
|
for (i = 0; i < l; i++) {
|