作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个正在进行的 angular 项目,我正在尝试将 Nebular Chat UI 添加到该项目中。
我使用 npm 安装了 nebular 并按照网站中的说明进行了导入。功能按预期工作,但样式未应用于组件。
以下是我遵循的步骤。
import { NbThemeModule, NbChatModule } from '@nebular/theme';
@NgModule({
imports: [
...
NbThemeModule.forRoot(),
NbChatModule
]
"styles": [
"node_modules/@nebular/theme/styles/prebuilt/default.css"
<nb-chat title="Nebular Conversational UI">
<nb-chat-message *ngFor="let msg of messages"
[type]="msg.type"
[message]="msg.text"
[reply]="msg.reply"
[sender]="msg.user.name"
[date]="msg.date"
[files]="msg.files"
[quote]="msg.quote"
[latitude]="msg.latitude"
[longitude]="msg.longitude"
[avatar]="msg.user.avatar">
</nb-chat-message>
<nb-chat-form (send)="sendMessage($event)" [dropFiles]="true">
</nb-chat-form>
最佳答案
我遇到了同样的问题,我通过将聊天组件包装在 <nb-layout>
中解决了这个问题。和 <nb-layout-column>
.我错过了这个,因为我只打算使用聊天组件。
<nb-layout>
<nb-layout-column>
<nb-chat title="Chat" size="medium">
<nb-chat-message
*ngFor="let msg of messages"
[type]="msg.type"
[message]="msg.text"
[reply]="msg.reply"
[sender]="msg.user.name"
[date]="msg.date"
[files]="msg.files"
[quote]="msg.quote"
[latitude]="msg.latitude"
[longitude]="msg.longitude"
[avatar]="msg.user.avatar"
>
</nb-chat-message>
<nb-chat-form (send)="sendMessage($event)" [dropFiles]="true"> </nb-chat-form>
</nb-chat>
</nb-layout-column>
</nb-layout>
关于Angular Nebular 样式不适用于 NbChatComponent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61104967/
我是一名优秀的程序员,十分优秀!