I am trying out polymer and could not make it to work a simple component. Based on the docs. I have done the following thing
Added webcomponents.js, imported polymer.html and created a simple helloworld component without any script. I can see everyhting loaded in the DEV tools but the shawdow root is not created in helloworld components.
Polymer version is "polymer": "Polymer/polymer#~1.0.5"
Below is the hello world code.
<polymer-element name="hello-world" noscript>
<template>
<h1>Hello World</h1>
</template>
</polymer-element>
But no shawdow root in helloworld.
What am I doing wrong here.
答案 0 :(得分:1)
您使用的是Polymer v1.0,但您似乎没有按照此版本的方式声明您的元素。见here:
<dom-module id="hello-world">
<style>
/* CSS rules for your element */
</style>
<template>
<!-- local DOM for your element -->
<h1>Hello world</h1>
</template>
<script>
// element registration
Polymer({
is: "hello-world"
});
</script>
</dom-module>