* zin: fix navbar not update as expected.

This commit is contained in:
sunhao
2023-06-21 17:44:53 +08:00
parent 02ab7d5e5e
commit 0483fdcb6d
+10
View File
@@ -76,6 +76,7 @@
configJS: (data) => $('#configJS')[0].text = data,
activeFeature: (data) => activeNav(data, '#featureBar'),
activeMenu: activeNav,
navbar: updateNavbar,
table: updateTable,
fatal: showFatalError,
zinDebug: (data, _info, options) => showZinDebugInfo(data, options),
@@ -176,6 +177,15 @@
if(DEBUG) zui.Messager.show({content: 'ZIN: load an old page.', close: false});
}
function updateNavbar(data)
{
const $navbar = $('#navbar');
const $newNav = $(data);
if($newNav.text().trim() !== $navbar.text().trim()) return $navbar.empty().append($newNav);
activeNav($newNav.find('.nav-item>a.active').data('id'), $navbar);
}
function activeNav(activeID, nav)
{
const $nav = $(nav || '#navbar');