-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
23 lines (20 loc) · 912 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
export default class MenuItem {
constructor(config = {}) {
const routeMeta = config.route && config.route.meta ? config.route.meta : {};
this.count = config.count || null;
this.divider = config.divider || false;
this.hideTitle = config.hideTitle || false;
this.icon = config.icon || routeMeta.icon || null; // BIcon icon prop
this.imageUrl = config.imageUrl || null;
this.menuItems = config.menuItems ? config.menuItems.map(menuItem => new MenuItem(menuItem)) : [];
this.onClick = config.onClick || null;
this.route = config.route || {}; // Vue Router Route
this.secondaryMenuActive = config.secondaryMenuActive || false;
this.title = config.title || routeMeta.title || '';
this.usePsIcon = config.usePsIcon || false;
this.when = config.when !== undefined ? config.when : null;
}
get shouldShowTitle() {
return this.title && !this.hideTitle;
}
}