easyui框架打开新页面添加一个新选项卡

easyui框架打开新页面添加一个新选项卡,第1张

function ClickEvent() {

var title = $(this).text()//选项卡名称

//拼接一个Iframe标签,选项卡内容

var str = '<iframe id="frmWork" width="100%" height="100%" frameborder="0" scrolling="auto" src="' + $(this).attr("src") + '"></肆改iframe>'

//首先判断用户是否已经单击了此项,如果单击了直接获取焦点,否则打开

var isExist = $("#tab").tabs('exists', title)

if (!isExist) {

//添加tab的节点,调用easyUITab标签的方法

$("#tab").tabs('add', {

title: title,

content: str,

iconCls: 'icon-save',

closable: true

})

}

else {

//如果存在消纤则获取裂桥判焦点

$("#worktab").tabs('select', title)

}

})

}

在用到的地方调用这个函数

function addTab(){

$('#tt').tabs('add',{

title:'樱昌New Tab ' ,

content:'Tab Body ' ,

iconCls:'icon-save'旅卖,

closable:true,

tools:[{

// iconCls:'icon-mini-refresh',

handler:function(){

alert('拆颂逗add')

}

}]

})

}

建议你去看看官方论坛的那个实例,以及官方的demo。

标准的,左侧是树,右侧是tab的。

因为我一直是用的tree的插件,不是官方的tree,因此我看的官方demo+api,现写的一段

以下的ID之类的你改成顷激你自己的雀肢袜

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

<script>

$(function(){

$("tt").tree(

//这里加url之类的

,{

onClick:function(node){

openPage(node)

}

})

function openPage(node){

//已经存在的选择

if ($("#tabs").tabs('exists', node.text)) {

$("#tabs").tabs('select',node.text)

//否则添加tab

}else{

$("#tabs").tabs('add',{

title:node,text,

content:"xxx"饥冲,

closable:true

})

}

}

})

</script>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11977396.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-20
下一篇 2023-05-20

发表评论

登录后才能评论

评论列表(0条)

保存