标签内的Google Dart页面

时间:2014-09-29 12:51:14

标签: dart dart-polymer paper-elements core-elements

我正在尝试在Dart的标签页中加载“页面”,似乎无法正确设置它们。我的下面示例的页面应该在每个页面上显示文本输入,但页面位于选项卡中。我不确定如何在选项卡中正确设置这些页面。到目前为止,我一直在这个例子:Switching content when tab selected using polymer ui elements tabs如果您需要更多信息,请告诉我。

<paper-tabs id="Tabs" selected="0" style='width:800px; height:175px; color:green;'>

 <paper-tab id="systemtab"> System
 <core-pages selected="0">
  <paper-input id='version' label="Version:" readonly></paper-input>
</core-pages>
 </paper-tab>
 <paper-tab id="userTab"> User
  <core-pages selected="1">
  <paper-input id='Welcome' label="Display Welcome Page:" readonly></paper-input>
  <paper-input id='user_name' label="User Name:" readonly></paper-input>
  </core-pages>
 </paper-tab>

 </paper-tabs>

2 个答案:

答案 0 :(得分:1)

我尝试了它并且它到目前为止起作用了:

<link rel="import" href="../../packages/polymer/polymer.html">
<link rel='import' href='../../packages/paper_elements/paper_tabs.html'>
<link rel='import' href='../../packages/paper_elements/paper_tab.html'>
<link rel='import' href='../../packages/paper_elements/paper_input.html'>
<link rel='import' href='../../packages/core_elements/core_pages.html'>

<polymer-element name="app-element">
  <template>
    <style>
      :host {
        display: block;
      }
    </style>
    <paper-tabs id="Tabs" selected="{{page}}" style='width:800px; height:175px; color:green;'>
      <paper-tab>System</paper-tab>
      <paper-tab>User</paper-tab>
    </paper-tabs>

    <core-pages selected="{{page}}">
      <div>
        <paper-input id='version' label="Version:" readonly></paper-input>
      </div>
      <div>
        <paper-input id='Welcome' label="Display Welcome Page:" readonly></paper-input>
        <paper-input id='user_name' label="User Name:" readonly></paper-input>
      </div>
    </core-pages>

  </template>
  <script type="application/dart" src="app_element.dart"></script>
</polymer-element>
import 'package:polymer/polymer.dart';

@CustomTag('app-element')

class AppElement extends PolymerElement {

  @observable
  int page = 0;

  AppElement.created() : super.created();
}

答案 1 :(得分:0)

&#13;
&#13;
<link rel="import" href="../../packages/polymer/polymer.html">
<link rel='import' href='../../packages/paper_elements/paper_tabs.html'>
<link rel='import' href='../../packages/paper_elements/paper_tab.html'>
<link rel='import' href='../../packages/paper_elements/paper_input.html'>
<link rel='import' href='../../packages/core_elements/core_pages.html'>

<polymer-element name="app-element">
  <template>
    <paper-tabs id="tabs">
      <paper-tab>System</paper-tab>
      <paper-tab>User</paper-tab>
    </paper-tabs>

    <core-pages selected="{{$.tabs.selected}}">
      <div>
        <paper-input id='version' label="Version:" readonly></paper-input>
      </div>
      <div>
        <paper-input id='Welcome' label="Display Welcome Page:" readonly></paper-input>
      </div>
    </core-pages>

  </template>
  <script type="application/dart" src="app_element.dart"></script>
</polymer-element>
&#13;
&#13;
&#13;

能够绑定而不必创建&#34;页面&#34;这将是很好的。属性。我见过的例子使用了表达式&#34; {{$。id.attribute}}&#34;