简体   繁体   English

通过src标记在html页面中包含外部javascript文件

[英]Including external javascript file in html page via src tag

在此处输入图片说明

I'm trying out vuejs by following along with the laracasts series of webcasts on this. 我正在通过遵循与此相关的laracasts系列网络广播来尝试vuejs。 I'm using netbeans 8.1 as my editor and you can see my file structure above. 我使用netbeans 8.1作为编辑器,您可以在上面看到我的文件结构。 In https://laracasts.com/series/learning-vuejs/episodes/5 Jeffery Way shows the following code which I have adapted: https://laracasts.com/series/learning-vuejs/episodes/5中, Jeffery Way显示了我已改编的以下代码:

<head>
    <title>Tasks</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.12/vue.js"></script>
    <script type="text/javascript" src="Sources/app.js"></script>

</head>

In the console I see: 在控制台中,我看到:

GET http://localhost:8383/vue1/Sources/app.js net::ERR_EMPTY_RESPONSE

I suspect I have the file path wrong. 我怀疑我的文件路径错误。 I've been reading http://www.jibbering.com/faq/faq_notes/script_tags.html but have not not come up with an answer. 我一直在阅读http://www.jibbering.com/faq/faq_notes/script_tags.html,但没有找到答案。 What am I doing wrong? 我究竟做错了什么?

Is "Site Root" a subfolder on the same folder as "Sources"? “站点根目录”是否与“源文件”位于同一文件夹中?

If yes, try it out: 如果是,请尝试:

<script type="text/javascript" src="../Sources/app.js"></script>

Or move Sources dir to inside Site Root. 或将“源目录”移到“网站根目录”内部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM