Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 如何在react js树视图中查找最顶层的父id_Reactjs - Fatal编程技术网

Reactjs 如何在react js树视图中查找最顶层的父id

Reactjs 如何在react js树视图中查找最顶层的父id,reactjs,Reactjs,我正在尝试使用此“react checkbox tree”库绘制树视图。我想创建一个单独的链接按钮,当我单击该按钮时,相应的子节点将展开。如果我创建一个链接,那么它将为所有父节点和子节点创建相同的链接。 这是我的密码 { key: "renderLabel", value: function () { topnode++;

我正在尝试使用此“react checkbox tree”库绘制树视图。我想创建一个单独的链接按钮,当我单击该按钮时,相应的子节点将展开。如果我创建一个链接,那么它将为所有父节点和子节点创建相同的链接。 这是我的密码

{
                        key: "renderLabel",
                        value: function () {
                            topnode++;
                            //alert(topnode);
                            var e = this.props,
                                t = e.label,
                                n = e.showCheckbox,
                                r = [e.showNodeIcon ? /*f.a.createElement("span", { key: 0, className: "rct-node-icon" }, this.renderNodeIcon())*/
                                    null : null,
                                    f.a.createElement("span", { key: 1, className: "rct-title" }, t),// f.a.createElement("br"),
                                    f.a.createElement("span", { className: "totalcount" }, topnode+" / 30")];
                            //topnode--;
                           
                            return n ? this.renderCheckboxLabel(r) : this.renderBareLabel(r);
                        },
                    },
这是js文件中的代码。这将在每次单击任何叶子时创建节点。 这样地:

e=this.props,t=e.label,n=e.showCheckbox,r=[e.showNodeIcon
这些命名很难理解