胡锐 7 months ago
commit 8ad414aa26
  1. 12
      src/app/pages/body/tab/tab.component.ts

@ -3,7 +3,6 @@ import {NgForOf} from "@angular/common";
import {NzTabComponent, NzTabSetComponent} from "ng-zorro-antd/tabs";
import {ActivationEnd, Router, RouterOutlet} from "@angular/router";
import {filter} from "rxjs";
import {MenuService} from "../../../servies/menu/menu.service";
import {NzCardComponent} from "ng-zorro-antd/card";
@Component({
@ -30,22 +29,21 @@ export class TabComponent {
// 监听路由事件,只订阅 ActivationEnd 事件
this.router.events.pipe(filter(e => e instanceof ActivationEnd))
.subscribe((e) => {
.subscribe((e) => {
// 这里不强转VS Code编译通不过,有没有大佬有解决方法
const thisEvt = <ActivationEnd>e;
if (thisEvt.snapshot.routeConfig?.loadChildren) {
// 当前激活的路由
// const activatedRoutePath = thisEvt.snapshot.routeConfig?.path;
const activatedRoutePath = this.router.url;
// console.log(activatedRoutePath);
/* if (activatedRoutePath == '/admin/index') {
return;
}*/
// console.log(activatedRoutePath);
/* if (activatedRoutePath == '/admin/index') {
return;
}*/
const routeData = thisEvt.snapshot.queryParams;
let menuTitle = '新标签页';
if(routeData) {
menuTitle = routeData['title'];
}
// 该路由是否已激活,激活过则直接打开
let isExist = false;

Loading…
Cancel
Save