我试图通过从node_modules
而不是在线资源导入来实现ionic2中的nvd3图表。
当我从在线资源(index.html
)
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.4/nv.d3.min.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.4/nv.d3.min.js"></script>
但是当我尝试从node_modules
导入它时,它失败了。
<link href="../node_modules/nvd3/build/nv.d3.min.css" rel="stylesheet">
<script src="../node_modules/d3/d3.min.js" charset="utf-8"></script>
<script src="../node_modules/nvd3/build/nv.d3.min.js"></script>
答案 0 :(得分:0)
Hey I solved by adding the three files under assets/libs folder in the src folder in the project.
<link href="assets/libs/nv.d3.min.css" rel="stylesheet">
<script src="assets/libs/d3.min.js" charset="utf-8"></script>
<script src="assets/libs/nv.d3.min.js" ></script>