我这里有一个StackBlitz链接 - https://stackblitz.com/edit/ng-tootltip-ocdngb?file=src/app/bar-chart.ts
我在一个Angular应用程序中使用D3图表。
当悬停在柱形图上时,会出现提示框。
在较小的屏幕上,提示框位于窗口中心。
为此,我需要提示框的宽度,可以通过以下方式获得:
这是一个错误,我能停止它吗?
当悬停在柱形图上时,会出现提示框。
在较小的屏幕上,提示框位于窗口中心。
为此,我需要提示框的宽度,可以通过以下方式获得:
const toolTipWidth = tooltip.node().getBoundingClientRect().width;
这里的代码工作得很好,但是我的实际应用程序是一个Angular cli应用
应用程序仍然可以运行,但我会收到错误提示
error TS2339: Property 'getBoundingClientRect' does not exist on type 'BaseType'.
Property 'getBoundingClientRect' does not exist on type 'Window'.
这是一个错误,我能停止它吗?