gpt4 book ai didi

angular - 无法访问类函数内的私有(private)变量

转载 作者:行者123 更新时间:2023-12-02 17:02:59 24 4
gpt4 key购买 nike

我正在从事一个 Angular 项目并设计 d3 饼图。一切正常。但我的问题是我无法访问私有(private)类函数内的变量。

最佳答案

范围问题。改变

.attr('y', function (d, i) { return (this.legendHeight * (i + 1))})

.attr('y', (d, i) => { return (this.legendHeight * (i + 1))})

One of many docs

关于angular - 无法访问类函数内的私有(private)变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58235206/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com