Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.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
Javascript OrgChart.js模块未定义_Javascript_Asp.net Core_Razor_Orgchart - Fatal编程技术网

Javascript OrgChart.js模块未定义

Javascript OrgChart.js模块未定义,javascript,asp.net-core,razor,orgchart,Javascript,Asp.net Core,Razor,Orgchart,我正在尝试使用创建一个组织结构图。我做了github repo中显示的所有事情,但是当我尝试创建新的OrgChar时,我得到了未捕获的引用错误:OrgChart未定义错误。js文件显示在浏览器的源代码中,但我不明白为什么没有看到模块 以下是cshtml文件: @{ ViewData["Title"] = "Home Page"; } <div class="org-chart-container"> <

我正在尝试使用创建一个组织结构图。我做了github repo中显示的所有事情,但是当我尝试创建新的OrgChar时,我得到了未捕获的引用错误:OrgChart未定义错误。js文件显示在浏览器的源代码中,但我不明白为什么没有看到模块

以下是cshtml文件:

@{
    ViewData["Title"] = "Home Page";
}

<div class="org-chart-container">
    <button id="showChart" class="btn btn-danger" onclick="loadOrgChart()">Load chart</button>
    <div id="orgChart">
        <h5>Organigrama</h5>
    </div>
</div>

<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/dist/js/jquery.orgchart.js"></script>
<script src="~/js/organizationChart.js"></script>
有人能告诉我我做错了什么吗?我调用模块的方式是错误的还是js文件的导入?这是我的文件的结构:

你和他混在一起

将代码更改为:

let chart = new OrgChart({
            'chartContainer': '#orgChart',
            'data': datasource,
            'nodeContent': 'title',
        })
$('#orgChart').add(chart);
致:


您好@ANDU,我的回答有助于您解决问题吗?如果有,请接受我的回答。如果没有,请您继续告诉我。请参考:。谢谢。
let chart = new OrgChart({
            'chartContainer': '#orgChart',
            'data': datasource,
            'nodeContent': 'title',
        })
$('#orgChart').add(chart);
$('#orgChart').orgchart({
    'data': datasource,
    'nodeContent': 'title'
});