【问题标题】:how to add directive to d3 library in angular如何以角度向d3库添加指令
【发布时间】:2021-11-10 09:48:37
【问题描述】:

我试图向 d3 库添加一个 perfectScrollBar 指令 做这样的事情

svg.attr('perfectScrollBar', '')

位它不工作。 谁能给我一个例子,你如何在 d3 库中添加指令?

【问题讨论】:

  • '不工作':什么不工作?
  • 它没有将完美滚动条添加到我的容器中
  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: javascript angular d3.js angular-directive


【解决方案1】:

mb 它可以帮助某人。我找到了另一个解决方案

在 div 容器初始化后使用新的 PerfectScrollBar

在我的情况下,我在鼠标进入此容器时添加它

//'this' is html div container, scrollbar is a variable to have possibility update 
//PerfectScrollBar
    function onMouseEnter() {
                    if (!scrollBar) {
                        scrollBar = new PerfectScrollbar(this, {
                            wheelPropagation: false
                        });
                    } else {
                        scrollBar.update();
                    }
                }

【讨论】:

    猜你喜欢
    • 2020-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-19
    • 2021-08-06
    • 1970-01-01
    相关资源
    最近更新 更多