目录
1.简单介绍一下类的使用,类的声明使用 class +类名,如class A{},构造函数的声明使用constructor关键字,如constructor(name:string){}。
3.通过List把评论列表的数据渲染到页面上,通过scrollBar来显示滚动条,滚动条在滚动列表的时候才会显示,静止页面时就会消失。
1.简单介绍一下类的使用,类的声明使用 class +类名,如class A{},构造函数的声明使用constructor关键字,如constructor(name:string){}。
代码示例:
//声明一个Comment ,并且声明带两个参数的构造函数
class Comment {
id: string = util.generateRandomUUID(true);
content: string;
createTime: string;
constructor(content: string, createTime: string) {
this.content = content;
this.createTime = createTime;
}
}