Polymer App超过1个landpage

时间:2017-03-21 19:55:12

标签: polymer polymer-starter-kit firebase-polymer

大家好,我目前正在开展一个新项目。基本上我正在尝试构建一个超过1个页面的应用程序。

enter image description here

enter image description here

我选择铁页来显示要显示的页面。我创建了2个自定义组件和。到现在为止它只是h2标签。

[https://github.com/jeandersoncruz/my-app]

问题:这是正确的架构吗?为什么元素不在页面中呈现?

https://my-app-e6032.firebaseapp.com/

1 个答案:

答案 0 :(得分:2)

据我所知,您的架构没有任何问题。

也许检查依赖项的版本?

以下是使用今天(2017年3月22日)版本的参考工作片段(wc 1.0.0-rc.6,shady 1.0.0-rc.2,聚合物2.0.0-rc.3,铁2.0) -预习)。

当Polymer 2.0最终(即将发布)时,版本号将稳定下来。

  <base href="//polygit.org/webcomponentsjs+webcomponents+v1.0.0-rc.6/shadycss+webcomponents+1.0.0-rc.2/polymer+v2.0.0-rc.3/iron*+polymerelements+:2.0-preview/components/"></script>
  
  <script src="webcomponentsjs/webcomponents-loader.js"></script>

  <link rel="import" href="iron-pages/iron-pages.html">
  
  <shell-app></shell-app>
  
  <dom-module id="landpage-1">
    <template>
      <h2>Hello [[prop1]]</h2>
    </template>
    <script>
      class Mylandpage1 extends Polymer.Element {
        static get is() { return 'landpage-1'; }
        static get properties() {
          return {
            prop1: {
              type: String,
              value: 'landpage-1'
            }
          };
        }
      }
      window.customElements.define(Mylandpage1.is, Mylandpage1);
    </script>
  </dom-module>

  <dom-module id="shell-app">
    <template>
      <style>
        :host {
          display: block;
        }
      </style>
      <iron-pages selected="0">
        <div><landpage-1></landpage-1></div>
        <div><landpage-1></landpage-1></div>
      </iron-pages>
    </template>
    <script>
      class MyApplication extends Polymer.Element {
        static get is() { return 'shell-app'; }
        static get properties() {
          return {
            prop1: {
              type: String,
              value: 'shell-app'
            }
          };
        }
      }
      window.customElements.define(MyApplication.is, MyApplication);
    </script>
  </dom-module>