* Example Modify the interface document module tree.

This commit is contained in:
tianshujie
2023-03-10 16:35:14 +08:00
parent ccba4f20cd
commit 2a728e1b87
6 changed files with 70 additions and 27 deletions
+29 -1
View File
@@ -1,5 +1,6 @@
$(function()
{
initModule();
setHeight();
$(window).resize(setHeight);
});
@@ -12,6 +13,33 @@ $(function()
*/
function setHeight()
{
var paneHeight = $(window).height() - 100;
var paneHeight = $(window).height() - 90;
$('#sidebar .module-tree,#mainContent .module-content').css('height', paneHeight);
}
/**
* Init module tree by zui.
*
* @access public
* @return void
*/
function initModule()
{
$('#moduleTree').tree(
{
data: moduleTree,
initialState: 'active',
itemCreator: function($li, item)
{
console.log(item);
$li.append('<a data-module="' + item.key + '" data-has-children="' + (item.children ? !!item.children.length : false) + '" href=# title="' + item.title + '">' + item.title + '</a>');
if (item.active) $li.addClass('active open in');
}
});
$('#moduleTree').on('click', 'a', function(e)
{
var target = $(e.target);
if (target.attr('data-has-children') === 'true') return;
self.location.href = createLink('dev', 'api', 'module=' + target.attr('data-module'));
})
}
+1 -1
View File
@@ -12,6 +12,6 @@ $(function()
*/
function setHeight()
{
var paneHeight = $(window).height() - 100;
var paneHeight = $(window).height() - 90;
$('#sidebar .module-tree,#mainContent .module-content').css('height', paneHeight);
}