为什么我不能访问chrome dev工具中显示的javascript对象的attr

时间:2018-01-31 13:07:37

标签: javascript google-chrome

就像下面的Chrome开发工具屏幕截图一样,我试过了

object.depth

打印对象的总属性。但我无法通过

访问“深度”
// Call visit function to establish maxLabelLength
visit(treeData, function(d) {
    totalNodes++;
    maxLabelLength = Math.max(d.name.length, maxLabelLength);

    console.log(d); //I was debuging here
}, function(d) {
    return d.children && d.children.length > 0 ? d.children : null;
});

但我能够在此期间获得对象的名称,值,数量。

我想知道attr“深度”到底是什么。

enter image description here

源代码来自此帖子中的 D3.js树演示D3.js Drag and Drop, Zoomable, Panning, Collapsible Tree with auto-sizing.

但是,我试图使用节点的最大标签长度而不是总树的每个级别来定制计算节点宽度的算法。

{{1}}

0 个答案:

没有答案