css - PrimeNG Accordion 无法正常工作和显示

标签 css angular angular6 primeng

我正在尝试根据 official documentation 使用 primeNG Accordion

这是我的代码:

<p-accordion [multiple]="true">
    <p-accordionTab header="Godfather I">
        The story begins  as Don Vito Corleone, the head of a New York Mafia family, overseeshis daughter's wedding. His beloved son ichael has just come home from the war, but does not intend to become part of his father's business. T hrough Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family.
    </p-accordionTab>
    <p-accordionTab header="Godfather II">
        Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, The_Godfather parallels the young Vito Corleone's rise with his son Michael's spiritual fall, deepening The_Godfather's depiction of the dark side of the American dream. In the early 1900s, the child Vito flees his Sicilian village for America after the local Mafia kills his family. Vito struggles to make a living, legally or illegally, for his wife and growing brood in Little Italy, killing the local Black Hand Fanucci after he demands his customary cut of the tyro's business. With Fanucci gone, Vito's communal stature grows.
   </p-accordionTab>
    <p-accordionTab header="Godfather III">
        After a break of more than  15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family. Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate.
    </p-accordionTab>
</p-accordion>

我确保 import { AccordionModule } from 'primeng/accordion' 和 import AccordionModule 在 app.module.ts 中

问题#1:我有一个错误:错误错误:“找到合成监听器@tabContent.done。请在您的应用程序中包含“BrowserAnimationsModule”或“NoopAnimationsModule”。”

我真的需要包含 BrowserAnimationsModuleNoopAnimationsModule 吗?官方文档中没有提到

问题 #2:我添加了 NoopAnimationsModule,现在问题消失了,但显示效果很差。

Accordion 内容和标题似乎重叠了: enter image description here

一个选项卡处于事件状态: enter image description here

请帮忙。如果有任何误用,请随时纠正我。 提前致谢!

最佳答案

感谢评论区的 David 和 Daniel。

对于问题 #1:是的,我需要导入 BrowserAnimationsModule

对于问题 #2:缺少 primeng.min.css。我必须在 angular.json 中添加“/node_modules/primeng/resources/primeng.min.css”

关于css - PrimeNG Accordion 无法正常工作和显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51600175/

相关文章:

HTML/CSS : image taking half of the screen

javascript - 获取arc svg上点击位置的 Angular

javascript - 使用jsplumb动态拖动和连接angular6中创建的节点

angular - 无法在服务中正确设置 POST 的 RequestOptionsArgs

添加其他 Div 时 CSS 文本对齐中心不起作用

css - 当我更改文本框中占位符的大小时,它看起来不对

angular - MatCheckbox - Angular Material - 单元测试 - 如何单击以选择/取消选择所有行

Angular 6 与 AWS ElasticSearch 连接

javascript - 使用递归组件时,Angular2 发出在子项中不起作用

angular - Material Form 控件在 Angular 应用程序中不可见