javascript 如何安装/使用backbone.js 框架?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12327370/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I install/use the backbone.js framework?
提问by user1618478
I'm new to JavaScript and was wondering how you install the backbone framework so that you can use it with javascript.
我是 JavaScript 新手,想知道如何安装主干框架,以便可以将它与 javascript 一起使用。
回答by Jukka K. Korpela
JOPLOmacedo's first comment contains the essential answer, but I'll elaborate it a bit:
JOPLOmacedo 的第一条评论包含了基本的答案,但我会详细说明一下:
Download jquery.js from the jQuerysite, underscore.js from the Underscore.jssite, and
Backbone.js
from the Backbone.jssite. Use the “development versions” first, as this may help you in debugging. You can place the .js
files in the same folder as your own test files, to keep things simple. (Later, you will find it better to place them in a separate folder.
从下载的jquery.js jQuery的网站,从underscore.js Underscore.js站点,并
Backbone.js
从Backbone.js的网站。首先使用“开发版本”,因为这可能有助于您进行调试。您可以将这些.js
文件与您自己的测试文件放在同一文件夹中,以保持简单。(稍后,您会发现将它们放在单独的文件夹中会更好。
In your HTML code, write (e.g. after all content, right before the end tag <body>
if you use one:
在您的 HTML 代码中,写入(例如,在所有内容之后,<body>
如果您使用以下标记,则在结束标记之前:
<script src="jquery.js"></script>
<script src="underscore.js"></script>
<script src="backbone.js"></script>
<script>
// Your own JavaScript code here
</script>
This should get you started. You can use e.g. the relatively simple Hello world code in the Hello Backbone.js tutorialto check that the installation is OK, before working on your own code. (The tutorial uses remotely hosted versions of the .js file, which is another possibility.)
这应该让你开始。在处理您自己的代码之前,您可以使用例如Hello Backbone.js 教程中相对简单的 Hello world 代码来检查安装是否正常。(本教程使用 .js 文件的远程托管版本,这是另一种可能性。)