我在一个以角为单位的项目中工作,我必须在其中集成D3JS,我使用
npm install d3而且它工作得很好。我需要在js文件中使用一个函数。我遵循了导入它的一些步骤,但仍然得到了错误,这是我所做的:我将js文件放在节点模块中。然后我在angular.json文件中添加了路径,如下所示:
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/materialize-css/dist/js/materialize.min.js",
"node_modules/d3/labeler.js"
]在导入中,我使用了以下脚本:
import * as labeler from 'labeler.js';然后我再加上一项声明:
declare var labeler: any;最后,我想使用我在labeler.js中开发的函数标记器,以这样的方式:
d3.labeler()我得到了一个错误:
[WDS] Warnings while compiling. client:147
./node_modules/labeler.js
4:16-26 "export 'labeler' (imported as 'd3') was not found in 'd3' client:153
./src/app/components/init-map-markers/init-map-markers.component.ts
916:8-18 "export 'labeler' (imported as 'd3') was not found in 'd3'有没有人知道怎么用正确的方法做这件事?特克斯
发布于 2018-07-19 13:32:12
您可以使用由社区构建和维护的类型,而不是手工创建类型。
https://stackoverflow.com/questions/51423800
复制相似问题