fix: expose all page objects to window for inline onclick handlers
This commit is contained in:
@@ -82,10 +82,11 @@ const App = {
|
||||
|
||||
showPublic(page, param) {
|
||||
document.getElementById('top-bar').classList.remove('hidden');
|
||||
document.getElementById('top-auth').classList.remove('hidden');
|
||||
document.getElementById('main-layout').classList.add('hidden');
|
||||
const pub = document.getElementById('public-page');
|
||||
pub.classList.remove('hidden');
|
||||
const topAuth = document.getElementById('top-auth');
|
||||
if (Auth.logged()) { topAuth.classList.add('hidden'); } else { topAuth.classList.remove('hidden'); }
|
||||
const comp = page === 'login' ? LoginPage : page === 'register' ? RegisterPage : page === 'install' ? InstallPage : HomePage;
|
||||
comp.render(param).then(html => { pub.innerHTML = html; if (comp.mount) comp.mount(param); }).catch(() => {
|
||||
pub.innerHTML = '<div class="pub-card"><div class="logo"><i class="fas fa-exclamation-triangle" style="color:var(--d)"></i><h2>加载失败</h2><p>请刷新页面重试</p></div></div>';
|
||||
@@ -118,3 +119,22 @@ const App = {
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => App.init());
|
||||
window.App = App;
|
||||
window.Dashboard = Dashboard;
|
||||
window.TicketsPage = TicketsPage;
|
||||
window.TicketDetail = TicketDetail;
|
||||
window.TicketCreate = TicketCreate;
|
||||
window.TrackingPage = TrackingPage;
|
||||
window.UnclaimedPage = UnclaimedPage;
|
||||
window.UsersPage = UsersPage;
|
||||
window.TemplatesPage = TemplatesPage;
|
||||
window.NotificationsPage = NotificationsPage;
|
||||
window.SettingsPage = SettingsPage;
|
||||
window.ExportPage = ExportPage;
|
||||
window.LoginPage = LoginPage;
|
||||
window.RegisterPage = RegisterPage;
|
||||
window.HomePage = HomePage;
|
||||
window.InstallPage = InstallPage;
|
||||
window.U = U;
|
||||
window.Auth = Auth;
|
||||
window.API = API;
|
||||
|
||||
Reference in New Issue
Block a user