-
xiao12 数据达人Lv4
发表于2020-4-30 09:57
悬赏20
已解决
楼主
怎么在门户中制作标签页,详细点
最佳答案
拖入标签页到门户中,将左树和标签页进行关联,在树的鼠标单击事件中输入关联脚本如下:
复制代码
- function(item,e,etree){
- if(!item) return;
- var url = item.url;
- if(!url) return;
- var baseDom = etree.getBaseDom();
- var xuiDom = baseDom.parentElement;
- var id = xuiDom.getAttribute("data-id");
- var pagetab = $p.$("pagetab").getComponent();
- var index = pagetab.getIndex("url", url);
- if(index !== -1){
- pagetab.setActive(index);
- } else {
- pagetab.add(item.getItemText(), null , {data : {url : url, urlparams : item.urlparams, refreshcaption : true,onload : refreshTree}});
- }
- }
- var refreshTree = function(){
- wnd.refreshLeftTree = function(){
- $p.$(id).refresh();
- }
- }
6个回答
拖入标签页到门户中,将左树和标签页进行关联,在树的鼠标单击事件中输入关联脚本如下:
- function(item,e,etree){
- if(!item) return;
- var url = item.url;
- if(!url) return;
- var baseDom = etree.getBaseDom();
- var xuiDom = baseDom.parentElement;
- var id = xuiDom.getAttribute("data-id");
- var pagetab = $p.$("pagetab").getComponent();
- var index = pagetab.getIndex("url", url);
- if(index !== -1){
- pagetab.setActive(index);
- } else {
- pagetab.add(item.getItemText(), null , {data : {url : url, urlparams : item.urlparams, refreshcaption : true,onload : refreshTree}});
- }
- }
- var refreshTree = function(){
- wnd.refreshLeftTree = function(){
- $p.$(id).refresh();
- }
- }
xiao12 发表于 2020-4-30 10:18
报错了 Cannot read property 'getComponent' of undefined
代码中的“pagetab”需要和标签页组件的标识统一: