我可以在JSFiddle上使用Polymer吗?

时间:2015-12-03 19:42:39

标签: javascript polymer jsfiddle polymer-1.0 jsbin

我想在像JSFiddle或JavaScript Bin这样的沙箱中创建Polymer元素的快速原型,但是我无法让它工作!

1 个答案:

答案 0 :(得分:10)

是的,你可以,感谢polygit

这是一个可以分叉的样板示例:https://jsfiddle.net/kaycebasques/2q3fqehz/

HTML:

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

<dom-module id="x-example">
  <template>
    <style>
      :host {
        display: block;
      }
    </style>
    <h1>polyfiddle</h1>
  </template>
</dom-module>

<x-example></x-example>

JS:

// only need this when in the main document and on non-Chrome
addEventListener('WebComponentsReady', function() {
  Polymer({
    is: 'x-example'
  });
});
相关问题