gpt4 book ai didi

javascript - 如何将超链接传递到 Carrot Search FoamTree?

转载 作者:行者123 更新时间:2023-11-28 07:11:16 31 4
gpt4 key购买 nike

我正在使用 Carrot Search FoamTree 代码将超链接添加到我的 html 页面。这是我的代码:

<script>
// Initialize FoamTree after the whole page loads to make sure
// the element has been laid out and has non-zero dimensions.
window.addEventListener("load", function() {
var foamtree = new CarrotSearchFoamTree({
// Identifier of the HTML element defined above
id: "visualization",

// Some data to visualize.
dataObject: { groups: [
{ label: "Alkaloid", weight: 1.0, trigger: true},
{ label: "Flavonoids", weight: 3.0 },
{ label: "Terpenoids", weight: 2.0 },
{ label: "Alkaloid", weight: 1.0 },
{ label: "Flavonoids", weight: 3.0 },
{ label: "Terpenoids", weight: 2.0 },
{ label: "Steroids", weight: 4.0 }
]},

});
});
</script>

我想生成生物碱、类黄酮、萜类化合物和类固醇的超链接。我该怎么做?

最佳答案

我通过将额外的参数传递到数据对象中解决了这个问题,当泡沫树深入到另一个泡沫树时特别有用。我对圆圈做同样的事情,例如将parentId和parentName传递给子对象,这样当onclick事件触发时,您就可以在事件对象中获得所需的所有信息,因为它只是向您传递该对象,其中包含您的 group,因此传递要在事件中使用的 url 可以简单地放入 group 对象中。

关于javascript - 如何将超链接传递到 Carrot Search FoamTree?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31288692/

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