你好我正在尝试使用 JointJS 库执行 Hello world 应用程序,如下所示: http://www.jointjs.com/tutorial#hello-world 我已经下载了 joint.js 和 joint.css 文件 我已将 HelloWorld 教程中给出的代码复制到 html 文件中,并从 firefox 浏览器 (26.0) 访问它 但它没有按预期工作并在教程中显示。 预期:应该出现两个带有链接的框。 实际:浏览器上没有任何内容。 Ater调试错误是: “NS_ERROR_FAILURE:”在 joint.js 中:
var bbox = this.el.getBBox();
代码是:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="joint.css" />
<script src="joint.js"></script>
</head>
<body>
<script type="text/javascript">
var graph = new joint.dia.Graph;
var paper = new joint.dia.Paper({
el: $('#myholder'),
width: 600,
height: 200,
model: graph
});
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>
问候 兰加纳特
最佳答案
您缺少纸质对象的支架。在开头添加以下内容 <body>
标签:
<div id="myholder"></div>
关于jointjs - 新手 : hello world using jointjs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21233427/