效果:模仿浏览器tab页 , 新开 关闭,批量操作,刷新页面 从缓存读取tab var tab = (function (window, undefined) { var id = 'itec_iproject_tab'; var key = id + $('#Login_Id').val(); var FixedTabCount = $('#' + id + ' div[data-options]').size(); //固定tab的数量 var cookie; var This; var Tab = function () { This = this; this.ShiftFlag = 0; //tab切换标志,兼容ie切换时触发onbeforeunload事件 this.RefreshTabs = {}; //需要刷新的tab页 this.Init.apply(this, arguments); }; var currTab; Tab.prototype.Init = function () { var $Tab = $('#' + id); cookie = $.parseJSON($.cookie(key)) || { "curr": "CreateProj", "tabs": [] }; this.GetSharedProj(); //有分享项目时,直接看到分享的项目 var tabs = ''; var arrTabs = cookie.tabs; $.each(arrTabs, function (i, n) { tabs = tabs + '<div id="' + n.id + '" title="' + tool.EncodeHtml(n.title) + '" data-options="iconCls:\'icon-type' + n.docType + '\',closable:true" ><iframe id="Frame_' + n.id + '" width="100%" height="95%" src="" frameborder="no" over-flow="scoll-y" ref="' + n.ref + '"></iframe></div>'; }); $Tab.append(tabs); $Tab.find('#' + cookie.curr).attr('selected', true); $Tab.tabs({ onSelect: function (title, index) { var $tab = $Tab.tabs('getSelected'); var iframe = $tab.find('iframe'); //判断刷新 This._handleRefreshTabs(iframe, index); cookie.curr = $tab.attr('id'); $.cookie(key, JSON.stringify(cookie), { expires: 365 }); SetCurrTab(index, title, cookie.curr, iframe.attr('ref')); }, onBeforeClose: function (title, index) { var t = cookie.tabs[index - Fixed
基于EasyUi拓展tab标签页
最新推荐文章于 2023-05-17 11:41:33 发布