从功能树中打开功时关闭上一个从功能树打开的功能,要找到创建功能树执行打开功能的实现
3.3之前的版本,参考:
/UI2/portal/pc/index.js文件找到 $(‘li>a’, $content).click(function()函数的实现
1.在函数中加一个变量定义:var pageid = “”;
var me = this;
var pageid = "";
$('li>a', $content).click(function(){
var el = $(this);
2.在me.openPage的调用前加上closePage,并把me.openPage赋值给pid
if(pageid){
me.closePage(pageid);
}
pageid = me.openPage(cfg, {title: el.attr('title')});
3.3以及3.3后续版本中
/UI2/portal/pc/index.js文件找到$(‘li>a’, $content).click(function() {函数的实现
var me = this;
$('li>a', $content).click(function(){
var el = $(this),pageKey=el.attr('pageKey');
if(pageKey){
$(".func-open", $content).removeClass("func-open");
el.parent().addClass("func-open");
me.showPage(pageKey);
}
});
修改为:
var me = this;
var pageid = "";
$('li>a', $content).click(function() {
var el = $(this), pageKey = el.attr('pageKey');
if (pageKey) {
$(".func-open", $content).removeClass("func-open");
el.parent().addClass("func-open");
if(pageid)
me.closePage(pageid);
pageid = pageKey;
me.showPage(pageKey);
}
});
3.3之后的版本中还可以如下直接修改关闭其他所有的功能页
var me = this;
$('li>a', $content).click(function() {
var el = $(this), pageKey = el.attr('pageKey');
if (pageKey) {
$(".func-open", $content).removeClass("func-open");
el.parent().addClass("func-open");
me.closeAllPage();
me.showPage(pageKey);
}
});
评一波