如何在JSFiddle中导入核心元素和纸张元素。
我通过这些声明进口聚合物:
<script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.4.2/platform.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.4.2/polymer.js"></script>
如何导入例如core-input
或paper-input
?
是的,来自聚合物项目现场,或者我猜你的cloudflare cdn,如果你知道的位置
<script src="http://www.polymer-project.org/platform.js"></script>
<link rel="import" href="http://www.polymer-project.org/components/polymer/polymer.html">
<link rel="import" href="http://www.polymer-project.org/components/paper-button/paper-button.html">
<link rel="import" href="http://www.polymer-project.org/components/core-header-panel/core-header-panel.html">
这只是用于开发而非生产。
如果你选择了聚合物元素,然后选择你的元素,点击"获取元素"按钮,它会给你一个带有导入链接的弹出窗口。
此外,您还可以从这里获得所有核心或纸张元素的链接
一个好的替代方案-仍在进行中-是https://ele.io/
Ele(称之为"Ellie")是一个简化的环境,用于探索、试验和共享使用Web组件制作的可重复使用的自定义HTML元素。
要测试Polymer 1.0中编写的简单组件,我使用以下代码段:
<link rel="import" href="https://raw.githubusercontent.com/Polymer/polymer/master/polymer.html">
<dom-module id="proto-element">
<template>
<span>I'm <b>proto-element</b>. Check out my prototype.</span>
</template>
</dom-module>
<script>
Polymer({
is: "proto-element",
ready: function() {
//...
}
});
</script>
<proto-element></proto-element>
http://jsfiddle.net/MartyIX/84b5sabw/