我有一个正在进行的 angular 项目,我正在尝试将 Nebular Chat UI 添加到该项目中。
我使用 npm 安装了 nebular 并按照网站中的说明进行了导入。功能按预期工作,但样式未应用于组件。
以下是我遵循的步骤。
在 app.module.ts 中导入 NbThemeModule 和 NbChatModule
import { NbThemeModule, NbChatModule } from '@nebular/theme';
@NgModule({
imports: [
...
NbThemeModule.forRoot(),
NbChatModule
]
Run Code Online (Sandbox Code Playgroud)在 angular.json 中添加样式
"styles": [
"node_modules/@nebular/theme/styles/prebuilt/default.css"
Run Code Online (Sandbox Code Playgroud)添加了 html 组件(站点中提供了示例)
<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>
Run Code Online (Sandbox Code Playgroud)
输出 1
参考:
https://akveo.github.io/nebular/docs/guides/install-nebular#manually …
我试着做一个学生注册计划.所以我也写了一个类文件.使用该类文件,我将值放到ArrayList中.但问题是,如果我输入有关3名学生的详细信息,最后它只会打印最后一名学生的详细信息两次.我是个乞丐,请帮我解决这个问题.
这是我写的主要方法;
Student obj = new Student();
Scanner in = new Scanner(System.in);
ArrayList<Student> List = new ArrayList<Student>();
for (;;) {
System.out.print("Enter the Student ID: ");
obj.setStudentID(in.next());
System.out.print("Enter the first name: ");
obj.setFirstName(in.next());
System.out.print("Enter the last name: ");
obj.setLastName(in.next());
System.out.print("Enter the Course Work 1 marks: ");
obj.setCwk01(in.nextInt());
System.out.print("Enter the Course Work 2 marks: ");
obj.setCwk02(in.nextInt());
System.out.print("Enter the final exam marks: ");
obj.setExam(in.nextInt());
List.add(obj);
System.out.print("Enter q to stop (or any other to continue): ");
String str = in.next();
if (str.equals("q") || str.equals("Q")) …Run Code Online (Sandbox Code Playgroud)