我不能使用d3提示。
import * as d3 from "d3";
import "d3-tip";
var tool_tip = d3.tip()
Run Code Online (Sandbox Code Playgroud)
我收到这样的错误。
Property 'tip' does not exist on type 'typeof "/home/viktor/projects/internet_trading_platform/client/node_modules/@types/d3/index"'.
Run Code Online (Sandbox Code Playgroud)
I have imported the d3 tip modules have to augment the d3 module. But it does not. According to https://www.typescriptlang.org/docs/handbook/declaration-merging.html
Regards.
The d3-tip declaration is located here https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/d3-tip/index.d.ts
不是最好的答案,但对于遇到此问题的任何人来说,对我有用的解决方案是
正常导入 d3Tip
import * as d3Tip from 'd3-tip';
Run Code Online (Sandbox Code Playgroud)
然后在初始化提示时
var tipObject = (<any>d3Tip)()
.attr('class', 'd3-tip')
.html('Loading...');
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
633 次 |
最近记录: |