UNPKG

599 BJavaScriptView Raw
1import { addLeadingSlash } from '../utils';
2export class RouterConfig {
3 static set config(e) {
4 this.__config = e;
5 }
6 static get config() {
7 return this.__config;
8 }
9 static get pages() {
10 return this.config.pages || [];
11 }
12 static get router() {
13 return this.config.router || {};
14 }
15 static get mode() {
16 return this.router.mode || 'hash';
17 }
18 static get customRoutes() { return this.router.customRoutes || {}; }
19 static isPage(url = '') {
20 return this.pages.findIndex(e => addLeadingSlash(e) === url) !== -1;
21 }
22}