【问题标题】:Custom polymer element doesn't show text自定义聚合物元素不显示文本
【发布时间】:2014-11-30 19:29:30
【问题描述】:

我正在使用 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>

为什么不显示文本?我应该改用属性吗?

【问题讨论】:

    标签: dart dart-polymer dart-editor


    【解决方案1】:

    我在输入问题时找到了答案,但以防万一其他人有同样的问题,这就是诀窍:

    <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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-28
      • 1970-01-01
      • 2014-05-12
      • 1970-01-01
      相关资源
      最近更新 更多