ser*_*gpa 5 typescript angular cesiumjs
我有一个文件声明了一些常量,如下所示:
// color-constants.ts: no imports in this file
export const aoiToImageMaterial = new Cesium.ColorMaterialProperty(
new Cesium.Color(0.4, 0.6, 0.8, 0.1)
);
export const aoiToImageOutline = new Cesium.Color(0.4, 0.6, 0.8, 1);
Run Code Online (Sandbox Code Playgroud)
但是,当我将它们导入我的 Angular 组件文件时,它们返回undefined:
import { Component, Input } from '@angular/core';
import { Aoi } from '../../../models/aoi.model';
import * as colorConstants from '../../color-constants';
@Component({
selector: 'cs-aoi',
templateUrl: './aoi.component.html',
styleUrls: ['./aoi.component.scss']
})
export class AoiComponent {
@Input('aoi') aoi: Aoi;
materialProperty;
outlineColor;
constructor() {
this.materialProperty = colorConstants.aoiToImageMaterial; // undefined
this.outlineColor = colorConstants.aoiToImageOutline; // undefined
}
}
Run Code Online (Sandbox Code Playgroud)
如果我在组件文件中声明这些常量,它会按预期工作,所以问题是导入/导出。该color-constants.ts文件不导入任何内容,因此我怀疑这是循环依赖问题。有人可以帮忙吗?
| 归档时间: |
|
| 查看次数: |
1065 次 |
| 最近记录: |