[英]Jointjs Hello World blank with no error in console
I created this based on their tut http://jointjs.com/tutorial 我是根据他们的tut http://jointjs.com/tutorial创建的
<html>
<head>
<title></title>
</head>
<body>
<div id="myholder" >
</div>
<link rel="stylesheet" type="text/css" href="joint.css">
<script type="text/javascript" src="joint.js"></script>
<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 }
});
</script>
</body>
</html>
But I can't see anything and no error console. 但是我什么也看不到,也没有错误控制台。 If I moved include at the end, I get error joint unknown. 如果我在结尾处移动了include,则会出现未知的错误联合。
Why ? 为什么呢
You forgot to add the created rectangles and the link to your graph. 您忘记将创建的矩形和链接添加到图形。
Add this line at the end of your script. 在脚本末尾添加此行。
graph.addCells([rect, rect2, link]);
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.