基于EasyUi拓展tab标签页

效果:模仿浏览器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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值