我已将最小的PrimeNG Menubar实例添加到正在使用的应用程序中。但是,当应用程序渲染时,菜单栏项(只有两个)是不均匀的。即这些项目按顺序呈现,但第一项低于第二项。
相关代码如下:
Angular组件:
import { Component, OnInit } from '@angular/core';
import { MenuItem } from 'primeng/api';
@Component({
selector: 'app-menubar',
templateUrl: './menubar.component.html',
styleUrls: ['./menubar.component.css']
})
export class MenubarComponent implements OnInit {
CORE_MENU_ITEMS: MenuItem[] = [
{
label: 'Home',
icon: 'fa fa-home',
routerLink: ['/home'],
},
{
label: 'Comics',
icon: 'fa fa-book',
items: [
{
label: 'Library',
icon: 'fas fa-book-reader',
routerLink: ['/comics'],
},
{
label: 'Import',
icon: 'fas fa-file-upload',
routerLink: ['/import'],
},
]
}
];
protected items: MenuItem[];
constructor() { }
ngOnInit() {
this.items = this.CORE_MENU_ITEMS;
}
}
组件HTML:
<p-menubar styleClass='border-0' [model]='items' [autoDisplay]='false'>
</p-menubar>
在.angular-cli.json中,我添加了:
"prefix": "app",
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.css",
"../node_modules/primeng/resources/primeng.min.css",
"../node_modules/primeng/resources/themes/start/theme.css",
"../node_modules/@fortawesome/fontawesome-free/css/all.min.css",
"styles.scss"
],