我在Dart编辑器中使用Dart来创建自定义聚合物元素。元素是一个按钮,我想像这样使用它:
<my-button>text</my-button>
就像你在HTML5中使用button
元素一样。元素内的文本应该是按钮上显示的文本。这是我的HTML代码:
<link rel="import" href="packages/polymer/polymer.html">
<polymer-element name="my-button">
<template>
</template>
<script type="application/dart" src="my-button.dart"></script>
</polymer-element>
为什么不显示文字?我应该使用属性吗?
答案 0 :(得分:0)
我在输入问题时想出了答案,但是为了防止其他人有同样的问题,这就是诀窍:
<link rel="import" href="packages/polymer/polymer.html">
<polymer-element name="my-button">
<template>
<content></content>
</template>
<script type="application/dart" src="my-button.dart"></script>
</polymer-element>