添加菜单页路由

This commit is contained in:
zhouyuejun
2018-10-29 16:27:34 +08:00
parent bec3bb9137
commit b2dc055a3d
58 changed files with 769 additions and 8 deletions
@@ -1,4 +1,5 @@
import { Component, OnInit, Input } from '@angular/core';
import { Router } from '@angular/router'
@Component({
selector: 'app-bar-menu',
@@ -8,7 +9,9 @@ import { Component, OnInit, Input } from '@angular/core';
export class BarMenuComponent implements OnInit {
@Input() data: Array<any>;
constructor() { }
constructor(
private router: Router
) { }
ngOnInit() {
}
@@ -28,6 +31,8 @@ export class BarMenuComponent implements OnInit {
itemClicked(item: any) {
if (!this.isLeaf(item)) {
item.isExpend = !item.isExpend;
} else {
this.router.navigate([item.path])
}
}