添加菜单页路由

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 { Component, OnInit, Input } from '@angular/core';
import { Router } from '@angular/router'
@Component({
selector: 'app-sidebar-menu',
@@ -9,7 +10,9 @@ export class SidebarMenuComponent implements OnInit {
//输入数据
@Input() data: Array<any>;
constructor() { }
constructor(
private router: Router
) { }
ngOnInit() {
@@ -30,6 +33,8 @@ export class SidebarMenuComponent implements OnInit {
itemClicked(item: any) {
if (!this.isLeaf(item)) {
item.isExpend = !item.isExpend;
} else {
this.router.navigate([item.path])
}
}