Polymer 1.x:在Plunker中获取自定义元素来说明HELLO WORLD

时间:2016-10-13 02:58:06

标签: polymer polymer-1.0 plunker iron-data-table polymer-1.x

In this Plunk, why won't the x-foo element render HELLO WORLD?

鉴于更复杂content-el似乎正确地导入iron-data-table。我忽略了简单的事情吗?请回答一下工作插件。

http://plnkr.co/edit/p7IE7v6DHLVnEggeO8PF?p=preview
<base href="https://polygit.org/polymer/components/">
<link rel="import" href="polymer/polymer.html">
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>

<dom-module id="x-foo">
    <template>
        <style></style>
        HELLO WORLD
    </template>

  <script>
    (function() {
      'use strict';
      Polymer({
        is: 'x-foo',

            });
        })();
  </script>
</dom-module>

1 个答案:

答案 0 :(得分:2)

您会注意到浏览器控制台显示:

  

https://polygit.org/polymer/components/polymer/polymer.html无法加载资源:服务器响应状态为400()

     

https://polygit.org/polymer/components/webcomponentsjs/webcomponents-lite.min.js无法加载资源:服务器响应状态为400()

     

x-foo.html:14未捕获的ReferenceError:未定义聚合物

浏览器无法找到Polymer所需的导入,因为您的<base>网址x-foo.html中格式错误的多字形配置:

<base href="https://polygit.org/polymer/components/">

polygit.org预计URL format

<server-name>/[<configurations>/]components/<component>/<path>

其中<configurations>/是:

<component>[+<org>]+<ver>|:<branch>|*

因此,您的<base>网址应为以下任意一种:

<base href="https://polygit.org/components/">
<base href="https://polygit.org/polymer+:master/components/">
<base href="https://polygit.org/polymer+v1.7.0/components/">

plunker