TypeScript - Visual Studio - d3 [英] TypeScript - Visual Studio - d3

查看:99
本文介绍了TypeScript - Visual Studio - d3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个新的TypeScirpt项目,将json文件添加到解决方案,将复制到输出目录属性更改为始终复制。

I created a new TypeScirpt project, added the json file to the solution, changed the 'Copy to Output directory' property to Copy always.

项目,浏览器抱怨它找不到资源 somedata.json

When I F5 the project, the browser complains that it cannot find the resource somedata.json

如果我运行python SimpleHTTPServer,加载相同的html文件,

If I run the python SimpleHTTPServer, load up the same html file, it works.

 <script type="text/javascript">
     d3.json("somedata.json", draw);
 </script>

谢谢。

推荐答案

这可能与允许Visual Studio使用的服务器提供的MIME类型相关。如果这是一个ASP.net项目,您可以在web.config btw定义这样的MIME类型。

This may be related to MIME types that the server used by Visual Studio is allowed to serve. You can define such MIME types at web.config btw if this is an ASP.net project.

也可以看到这个官方示例,如果它有帮助:
< a href =http://www.typescriptlang.org/Samples#D3 =nofollow> http://www.typescriptlang.org/Samples#D3

Also see this official example in case it helps: http://www.typescriptlang.org/Samples#D3

这篇关于TypeScript - Visual Studio - d3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆