如何使用React.js集成/访问getorgchart

时间:2019-04-29 07:14:08

标签: reactjs getorgchart

有什么方法可以将getorgchart与reactjs集成/使用,因为我想将其包含在我的react js应用程序中。我已经尝试过以下代码(即reactjs组件中的get getorgchart html代码),但是它没有用并且语法错误,请帮助我使用reactjs进行设置。

import React, { Component } from 'react';
   import { BrowserRouter as Router, Switch, Route, Link } from 'react- router-dom';

   class Chart extends React.Component {
   constructor (props) {
   super(props)
   this.state = {
      };
    }
   render() {
   return (
    <html>
   <head>
   <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
   <script src="https://balkangraph.com/js/latest/orgchart.js"></script>
   </head>
   <body>
   <div id="orgchart">
   </div>
   <script>
   var chart = new OrgChart(document.getElementById("orgchart"), {
       theme:"planner",   //getting error on ':' colon      
       enableEdit: false, 
        enableZoom:false,
        enableSearch: false,
        enableMove: true,
        enableDetailsView: false,

        nodeMenu:{
                details: {text:"Details"},
                edit: {text:"Edit"},
                add: {text:"Add"},
                remove: {text:"Remove"}
            },
            nodeBinding: {
                field_0: "name"

            },
            nodes: [
                { id: 1, name: "Amber McKenzie"},
                { id: 2, pid: 1, name: "Ava Field" },
                { id: 3, pid: 1, name: "Peter Stevens" }
            ]
        });

    </script>
</body>

</html>

    );
}

}
export default Chart;

0 个答案:

没有答案