【问题标题】:Polymer 1.0 not working聚合物 1.0 不工作
【发布时间】:2015-08-19 20:32:58
【问题描述】:

我正在尝试制作一个简单的“Hello World!”元素。我已经尝试使用 bower 安装聚合物组件,并且我使用了 zip 文件。我也使用了 python 和 npm HTTP 服务器,但我仍然没有得到任何输出。 <html> <head> <title>Polymer</title> <script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script> <link rel="import" href="elements/hello-world.html"> </head> <body unresolved> <hello-world></hello-world> </body> </html>

与元素文件 <link rel="import" href="../bower_components/polymer/polymer-mini.html"> <polymer-element name="hello-world" noscript> <template> <h1>Hello World!</h1> </template> </polymer-element>

【问题讨论】:

标签: polymer bower polymer-1.0


【解决方案1】:

您为聚合物元素使用了错误的 API。你应该像 Trevor Dixon 提到的那样使用&lt;dom-module&gt;

See Plunker

<link rel="import" href="../bower_components/polymer/polymer-mini.html">

<dom-module id="hello-world">
    <template>
    <h1>Hello World!</h1>
    </template>
</dom-module>

<script>
Polymer({
  is: 'hello-world'
})
</script>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-15
    • 2015-08-28
    • 1970-01-01
    • 2016-06-04
    • 1970-01-01
    相关资源
    最近更新 更多