【发布时间】:2016-10-02 17:14:43
【问题描述】:
我有以下代码在节点服务器上的文件上制作示例图
<!DOCTYPE html>
<html>
<head>
<title>newpageshere</title>
<link rel="stylesheet" href="joint.css" />
<script src="jquery.js"></script>
<script src="lodash.js"></script>
<script src="backbone.js"></script>
<script src="joint.js"></script>
</head>
<body>
<div id="myholder"></div>
<script type="text/javascript">
var graph = new joint.dia.Graph;
var paper = new joint.dia.Paper({
el: $('#myholder'),
width: 600,
height: 200,
model: graph,
gridSize: 1
});
var rect = new joint.shapes.basic.Rect({
position: { x: 100, y: 30 },
size: { width: 100, height: 30 },
attrs: { rect: { fill: 'blue' }, text: { text: 'my box', fill: 'white' } }
});
var rect2 = rect.clone();
rect2.translate(300);
var link = new joint.dia.Link({
source: { id: rect.id },
target: { id: rect2.id }
});
graph.addCells([rect, rect2, link]);
</script>
</body>
</html>
但是当我运行它时,它什么也没显示。在开发人员控制台中,我收到以下错误
var graph = new joint.dia.Graph;
错误: 未捕获的 ReferenceError:未定义关节
当我在 XAMPP localhost 上运行该文件时,它似乎运行良好,但当我在 node.js 服务器上运行它时却不行。我还需要在上面配置服务器吗?或者有人可以在这里看到错误吗?
【问题讨论】:
标签: javascript node.js jointjs