简单的聚合物脚本无效

时间:2015-10-25 21:47:09

标签: javascript html polymer

我是polymer的新人,我的第一个脚本无效...

我的代码:


的index.php

<!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>


hello-world.html (更新):

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

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

<script>
    Polymer({is: "hello-world"});
</script>
</dom-module>   

图书馆:

polymer.htmlhttp://pastebin.com/jd1rxAuH

wecomponents.jshttp://pastebin.com/yBaJpFBi


在这里上传:https://www.sese7.de/polymer/

我不知道自己做错了什么,提前谢谢;)

1 个答案:

答案 0 :(得分:0)

可以在Polymer Migration Guide阅读。

  

<polymer-element>标记不再用于定义元素。在此版本中,这些元素由<dom-module>元素(用于定义本地DOM和样式)和Polymer调用(用于注册元素)替换。

可以在http://webcomponents.org/hello-world-polymer/bower_components/hello-world-polymer/看到一个工作示例,其中hello-world.html的定义类似于:

<link rel="import" href="../polymer/polymer.html">
<dom-module id="hello-world">
    <template>
        <h1>Hello world</h1>
    </template>
    <script>
        // the is is important here since it specifies the element name
        Polymer({is: "hello-world"});
    </script>
</dom-module>
相关问题