的index.html
<!doctype html>
<html>
<head>
<title>My Test</title>
<script src="./components/platform/platform.js"></script>
<link rel="import" href="my-element.html">
<style>
div { width: 300px;}
my-element { font: bold 16px cursive;}
</style>
</head>
<body>
<div>
<my-element></my-element>
</div>
</body>
</html>
我-element.html
<polymer-element name="my-element">
<template>
<div>
<p>rtrthdfghdfghdfghdgsdfasdfa</p>
</div>
</template>
</polymer-element>
屏幕上没有任何反应。 使用chrome SDL检查所有资源都已加载ok(200)。
这是渲染后的页面源:
<!doctype html>
<html>
<head>
<title>My Test</title>
<!-- <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> -->
<script src="./components/platform/platform.js"></script>
<link rel="import" href="my-element.html">
<style>
div { width: 300px;}
my-element { font: bold 16px cursive;}
</style>
</head>
<body>
<div>
<my-element></my-element>
</div>
</body>
</html>
我做错了什么?
答案 0 :(得分:2)
你需要改变两件事:
noscript
属性添加到您的元素,因为它不包含JavaScript且未使用Polymer('my-element',{});
<link rel="import" href="./components/polymer/polymer.html">