-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.js
More file actions
32 lines (27 loc) · 1010 Bytes
/
App.js
File metadata and controls
32 lines (27 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import Router from "./Router.js";
import Component from "./core/Component.js";
import createPages from "./pages/index.js";
import Footer from "./components/Footer.js";
export default class App extends Component {
template() /*html*/ {
return `
<main>
</main>
<footer></footer>
`;
}
mounted() {
const $main = this.$target.querySelector("main");
const pages = createPages($main);
const id = [...Array(3367).keys()].map((i) => i); // 추후 데이터 불러온 뒤 데이터 id 배열로 교체 필요(임시로 0~9까지 넣어 두었습니다.)
const router = new Router($main);
router.addRoute("#", pages.landing);
router.addRoute("#category", pages.category);
router.addRoute("#search", pages.search);
router.addRoute("#temp", pages.temp);
router.addRoute("#bookmark", pages.bookmark);
id.forEach((item) => router.addRoute(`#detail/${item}`, pages.detail));
router.start();
new Footer(this.$target.querySelector("footer"));
}
}