0
클래스의 오브젝트는 set
일 수 있습니까? 해결 I get
내가 가진 지금오브젝트가있는 ECMAScript 2015/TypeScript 2 설정자
interface IAddress {
streetAddress: string;
postCode: string;
city: string;
}
class C {
private _data = <any> {};
public get postAddress(): IAddress {
return this._data.postAddress;
}
/*
public set postAddress() {
}
*/
}
let a = new C();
:
let address = a.postAddress;
/*
{
streetAddress: "";
postCode: "";
city: "";
}
*/
가 그럼 난 세터를 통해 몇 가지 속성을 설정하려면 (내가 수 없습니다 모르겠어요 방법) :
a.postAddress.city = 'NEW YORK';
a.postAddress
이 먼저 객체를 가져오고 C
클래스 'setter가 호출되지 않습니다. 이것을 달성하는 방법?