class Person {
constructor() {
}
private _name:string;
public get name():string{
return this._name;
}
public set name(name:string){//不能定义返回类型,如: ":void"
this._name = name;
}
}
TypeScript set和get
最新推荐文章于 2024-04-28 21:50:29 发布