1
我正在尝试使enum
处理国家&货币代码。 enum
必须通过整个应用程序(Ionic 3 Angular 4应用程序)使用。角4使用命名空间导出枚举
到目前为止,我发现这种方式:
enum CountryCode {
TH,
BGD,
}
namespace CountryCode {
export function getCurrencyCode(country: CountryCode) {
switch (country) {
case CountryCode.TH:
return 'THB';
case CountryCode.BGD:
return 'BDT';
default:
return 'THB';
}
}
}
然而
在这种情况下,enum
不能出口到其他模块。
我该如何解决这个问题?
出口添加到您的枚举 - 出口枚举COUNTRYCODE {} – JEMI