Closed nakyeonko3 closed 3 months ago
Feat: 클래스형태의 라우트 제작중
export class Route { constructor({ routes, routeView } = {}) { this.routes = routes || {}; this.routeView = routeView || document.querySelector('route-view'); } router(props) { let view = this.routes[location.pathname]; if (view) { document.title = view.title; routeView.innerHTML = ''; view.render(props); } else { history.replaceState('', '', '/'); routeView.innerHTML = ''; router(); } } renderComponent(ComponentClass) { const componentInstance = new ComponentClass(routeView, {}); componentInstance.render(); } }
Feat: 클래스형태의 라우트 제작중