Javascript Polymer在http服务器上不显示任何内容
我创建了一个聚合物元素,如下所示 hello-world.htmlJavascript Polymer在http服务器上不显示任何内容,javascript,html,polymer,Javascript,Html,Polymer,我创建了一个聚合物元素,如下所示 hello-world.html <link rel="import" href="../bower_components/polymer/polymer.html"> <dom-module id="hello-world"> <template> <p><h1>Hello World</h1></p> </template>
<link rel="import" href="../bower_components/polymer/polymer.html">
<dom-module id="hello-world">
<template>
<p><h1>Hello World</h1></p>
</template>
<script>
Polymer ({ is: "hello-world", });
</script>
</dom-module>
启动localhost:8080/index.html将显示一个空白网页。需要解决的问题在哪里?您说您的html文件是
hello world.html
。但是您正在尝试访问localhost:8080/index.html
。看到区别了吗?访问localhost:8080/hello world.html
或将hello world.html
重命名为index.html
问题在于我在地址栏中键入的URL。我必须键入“localhost:8080/polymer/”,其中polymer是包含index.html的文件夹
我改为键入“localhost:8080/index.html”,这是错误的。Rando的回答帮助我解决了这个问题。谢谢Rando 谢谢你的回答。一、 但是,我们提到了聚合元素是用“helloworld.html”编写的。“index.html”正在访问它。
<!DOCTYPE html>
<html>
<head>
<script src="bower_components/webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="elements/hello-world.html">
</head>
<body>
<hello-world></hello-world>
</body>
</html>
http-server C:\Users\Admin\polymer