easyui tab只在窗口中打开一个,而不是多个在一起的

来源:互联网 发布:上海交通网络教育学院 编辑:程序博客网 时间:2024/06/08 22:25


在index.html里面有个addTab(title, url)方法,然后每次创建前获取当前的并删除就可以,具体代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function addTab(title, url){
    //关闭当前的
    var currTab = $('#tabs').tabs('getSelected');
    if(currTab){
        $('#tabs').tabs('close',currTab.panel('options').title);
    }
     
     
    if ($('#tabs').tabs('exists', title)){
        $('#tabs').tabs('select', title);//选中并刷新
        var currTab = $('#tabs').tabs('getSelected');
        var url = $(currTab.panel('options').content).attr('src');
        if(url != undefined && currTab.panel('options').title != 'Home') {
            $('#tabs').tabs('update',{
                tab:currTab,
                options:{
                    content:createFrame(url)
                }
            })
        }
    else {
        var content = createFrame(url);
        $('#tabs').tabs('add',{
            title:title,
            content:content//,
            //closable:true
        });
    }
    tabClose();
}
阅读全文
0 0