4

I try to use the content-tag in dart polymer. The Polymer-Element is displayed properly, but the content is not displayed at all.

This is my code:

<polymer-element name="modal-dialog" >
  <link rel="stylesheet" href="packages/bootjack/css/bootstrap.css">

  <template>

    <button on-click="{{show}}">jo</button>
    <div id="modal" class="modal fade" tabindex="-1" role="dialog">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times</button>
            <h3 style="margin: 0">Bootjack</h3>
          </div>
          <div class="modal-body">
            <content></content>
          </div>
          <div class="modal-footer" style="margin: 0">
            <button class="btn btn-success" data-dismiss="modal" id="ok">OK</button>
          </div>
        </div>
      </div>
    </div>
  </template>
<script type="application/dart">
import 'package:polymer/polymer.dart';
import 'package:bootjack/bootjack.dart';
import 'dart:html';

@CustomTag('modal-dialog')
class ModalDialog extends PolymerElement {

  Modal modal;

  ModalDialog.created() : super.created(){
    Modal.use();
    Transition.use();
    modal = Modal.wire(this.shadowRoot.querySelector("#modal"));

  }  
  void show(){
    modal.show();
  }
}
</script>     
</polymer-element>

Then I instantiate in the index.html:

<modal-dialog>This should be in the content-tag</modal-dialog>

I am using:
Dart Editor version 1.2.0.release (STABLE)
Dart SDK version 1.2.0
OS X 10.8.5

Thank you for any hints :)

4

1 回答 1

1

我试过你的代码。我删除了 CSS 链接,内容显示在正确的位置。

可能你遇到了和我最近 在入口页面标题中链接的 CSS 通过 pub build 移动到内容中相同的错误

在您的样式标签后添加此 CSS

<style>
  * {
    display: block;
    border: solid 3px red;
  }
</style>

您会看到 CSS 已移至内容中。Polymer 目前似乎对 CSS 有一些问题。

于 2014-02-27T16:29:34.410 回答