【发布时间】:2019-09-23 23:04:11
【问题描述】:
我必须在我的 Angular 7 项目中使用 Leaflet-pixi-overlay 库,所以 我已经安装并导入了https://github.com/manubb/Leaflet.PixiOverlay 中引用的所需库:
import * as PIXI from 'pixi.js';
import {pixiOverlay} from 'leaflet-pixi-overlay';
当我调用库函数时:
147 - const a = pixiOverlay(
148 - (utils) => {
149 - // your drawing code here
150 - }, new PIXI.Container());
我收到以下错误:
zone.js:192 Uncaught TypeError: Object(...) is not a function
at MapComponent.push../src/app/modules/map/components/map/map.component.ts.MapComponent.ngOnInit (map.component.ts:147)
at checkAndUpdateDirectiveInline (core.js:18668)
at checkAndUpdateNodeInline (core.js:19932)
at checkAndUpdateNode (core.js:19894)
at debugCheckAndUpdateNode (core.js:20528)
at debugCheckDirectivesFn (core.js:20488)
at Object.eval [as updateDirectives] (VisionClientComponent.html:17)
at Object.debugUpdateDirectives [as updateDirectives] (core.js:20480)
at checkAndUpdateView (core.js:19876)
at callViewAction (core.js:20117)
有什么线索吗?谢谢
【问题讨论】:
-
你能把代码贴在 map.component.ts 第 147 行吗?
-
ngOnInit(): void { const a = pixiOverlay( (utils) => { // your drawing code here }, new PIXI.Container()); // Permet de recentrer la map quand on slide sur la gauche if (this.onComponentResize) { this.onComponentResize.subscribe(() => { if (this.map) { this.map.invalidateSize(); } }); } } -
对不起,我无法格式化上一条评论中的代码
-
第147行是哪一个:
pixiOverlay或PIXI.Container()? -
pixiOverlay 是行