Polygit进口iron-ajax似乎不起作用?

时间:2016-05-27 07:17:12

标签: polymer jsbin polygit

你如何用polygit正确导入iron-ajax?这给了我400错误

    <base href="https://polygit.org/components/">
    <script src="webcomponentsjs/webcomponents-lite.min.js"></script>
    <link href="polymer/polymer.html" rel="import">
    <link rel="import" href="iron-ajax/iron-ajax.html">

1 个答案:

答案 0 :(得分:1)

Polygit已弃用,不再有效。您可以在演示中使用以下<base>网址:

<head>
  <base href="https://cdn.rawgit.com/download/polymer-cdn/1.8.0/lib/">
  <link rel="import" href="polymer/polymer.html">
  <script src="webcomponentsjs/webcomponents-lite.js"></script>
  <link rel="import" href="iron-ajax/iron-ajax.html">
</head>
<body>
  <x-foo></x-foo>

  <dom-module id="x-foo">
    <template>
      <div>Please wait...</div>
      <iron-ajax id="ajax"
                 auto
                 url="http://jsonplaceholder.typicode.com/users/"
                 last-response="{{data}}"
                 handleAs="json">
      </iron-ajax>
      <table>
        <template is="dom-repeat" items="[[data]]">
          <tr>
            <td>[[item.id]]</td>
            <td>[[item.name]]</td>
            <td>[[item.email]]</td>
          </tr>
        </template>
      </table>
    </template>
    <script>
      HTMLImports.whenReady(function() {
        Polymer({
          is: 'x-foo'
        });
      });
    </script>
  </dom-module>
</body>

jsbin