Javascript GitGraph JS未从CDN加载
我正在努力工作,为我正在整理的文档生成一个类似GitFlow的图形 这是我的HTML文件:Javascript GitGraph JS未从CDN加载,javascript,cdn,Javascript,Cdn,我正在努力工作,为我正在整理的文档生成一个类似GitFlow的图形 这是我的HTML文件: <html> <head> <title>GitFlow</title> <script src="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.min.css"></script> <script>
<html>
<head>
<title>GitFlow</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.min.css"></script>
<script>
var gitgraph = new GitGraph({
template: "blackarrow",
reverseArrow: false,
orientation: "horizontal",
mode: "compact"
});
</script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.css" />
</head>
<body>
<canvas id="gitGraph"></canvas>
</body>
</html>
因此,出于某种原因,它没有从CDN中引入GitGraph。有人能看出我哪里出错了吗?这个
<script src="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.min.css"></script>
正在加载css文件。您可以从文件扩展名验证它
这是必须的
<script src="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.min.js"></script>
让它与此一起工作:
<html>
<head>
<title>GitFlow</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.css" />
</head>
<body>
<canvas id="gitGraph"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.min.js"></script>
<script>
var gitgraph = new GitGraph({
template: "blackarrow",
reverseArrow: false,
orientation: "horizontal",
mode: "compact"
});
gitgraph.branch().commit().commit();
</script>
</body>
</html>
GitFlow
var gitgraph=新gitgraph({
模板:“黑箭”,
罗:错,
方向:“水平”,
模式:“紧凑型”
});
gitgraph.branch().commit().commit();
谢谢@brk(+1),根据您的建议,我仍然得到一个空/空白页面,现在控制台错误是“未捕获类型错误:无法读取未定义的
的属性“getContext”…有什么想法吗?也许是GitGraph本身的一个bug?!
<html>
<head>
<title>GitFlow</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.css" />
</head>
<body>
<canvas id="gitGraph"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.min.js"></script>
<script>
var gitgraph = new GitGraph({
template: "blackarrow",
reverseArrow: false,
orientation: "horizontal",
mode: "compact"
});
gitgraph.branch().commit().commit();
</script>
</body>
</html>