【问题标题】:Polymer 1.x: Getting custom element to say HELLO WORLD in PlunkerPolymer 1.x:让自定义元素在 Plunker 中说 HELLO WORLD
【发布时间】:2016-10-18 04:24:35
【问题描述】:

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>

【问题讨论】:

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


【解决方案1】:

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

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

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

x-foo.html:14 Uncaught ReferenceError: Polymer is not defined

浏览器找不到 Polymer 所需的导入,因为您的 &lt;base&gt; URL 在 x-foo.html 中有格式错误的 polygit 配置:

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

预计URL formatpolygit.org

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

&lt;configurations&gt;/ 在哪里:

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

所以你的&lt;base&gt; URL 应该是以下任何一个:

<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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多