添加菜单页路由
This commit is contained in:
@@ -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])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user