我正在使用Firefox 43.0.1和Chrome 47.0.2526.106 m
运行Windows 7<!DOCTYPE html>
<html lang="en">
<head>
<title>Polymer tutorial</title>
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="bower_components/polymer/polymer.html" />
<link rel="import" href="hello-world.html" />
</head>
<body>
<hello-world name="Joe"></hello-world>
</body>
</html>
,组件
<dom-module id="hello-world">
<template>
<h1>Hello, User</h1>
</template>
<script>
Polymer({
is: "hello-world"
});
</script>
</dom-module>
Chrome拒绝渲染。 Firefox没有probs。
我在命令行输入bower install polymer
来安装聚合物。 bower.json说这是版本1.2.3
答案 0 :(得分:1)
尝试在组件的文件中导入Polymer Library,如下所示
的index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Polymer tutorial</title>
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="hello-world.html" />
</head>
<body>
<hello-world name="Joe"></hello-world>
</body>
</html>
组件
<link rel="import" href="bower_components/polymer/polymer.html" />
<!DOCTYPE html>
<html lang="en">
<head>
<title>Polymer tutorial</title>
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="bower_components/polymer/polymer.html" />
<link rel="import" href="hello-world.html" />
</head>
<body>
<hello-world name="Joe"></hello-world>
</body>
</html>
答案 1 :(得分:0)
的index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Polymer tutorial</title>
<script src="./bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="./hello-world.html" />
</head>
<body>
<hello-world name="Joe"></hello-world>
</body>
</html>
您好-world.html
<link rel="import" href="./bower_components/polymer/polymer.html" />
<dom-module id="hello-world">
<template>
<h1>Hello, User</h1>
</template>
<script>
Polymer({
is: "hello-world"
});
</script>
</dom-module>