Polymer 聚合物如何与内部成分反应

Polymer 聚合物如何与内部成分反应,polymer,Polymer,我正在用polymer做实验,看看我是否可以构建一个我已经用php/mootools开发的应用程序的移动版本 我想要实现的是一个单页应用程序,当它启动时会显示一个单一的图像启动屏幕,而在后台它会验证用户是否是smf论坛的登录成员。如果验证失败,它将重定向到登录url。因此,我认为index.html页面的主体将包含如下内容 <body> <forum-auth forumurl="/forum/authorize.php" login_url="/login" spla

我正在用polymer做实验,看看我是否可以构建一个我已经用php/mootools开发的应用程序的移动版本

我想要实现的是一个单页应用程序,当它启动时会显示一个单一的图像启动屏幕,而在后台它会验证用户是否是smf论坛的登录成员。如果验证失败,它将重定向到登录url。因此,我认为index.html页面的主体将包含如下内容

<body>
    <forum-auth forumurl="/forum/authorize.php" login_url="/login" splash="background.png">

      ... lots of content with further polymer elements with access to global variables
      {{token}} and {{user}} which gets returned by a successful logon. the token is a JWT and the user object is application specific.

    </forum-auth>
  <template>
      <div id="splash" class="show-splash-screen">
           <img src="{{splash}} />
      </div>
      <core-ajax url="{{forumurl}} handleAs="json" on-core-response={{handleResponse}}></core-ajax>
      <template if="{{token}}">    
          <content></content>
      </template> 
  </template>
聚合物元素的定义是这样的

<body>
    <forum-auth forumurl="/forum/authorize.php" login_url="/login" splash="background.png">

      ... lots of content with further polymer elements with access to global variables
      {{token}} and {{user}} which gets returned by a successful logon. the token is a JWT and the user object is application specific.

    </forum-auth>
  <template>
      <div id="splash" class="show-splash-screen">
           <img src="{{splash}} />
      </div>
      <core-ajax url="{{forumurl}} handleAs="json" on-core-response={{handleResponse}}></core-ajax>
      <template if="{{token}}">    
          <content></content>
      </template> 
  </template>
还有一些脚本将所有这些联系在一起,我还没有弄明白。但这将包括将ajax响应分配给this.token和this.user,并从作为splash元素的div中删除show splash screen类

我的问题是——这是构建这样一个需求的正确方法吗——我是否应该投入时间以这种方式构建这个令牌。我之所以这样问,是因为我不确定文档中对lightdom的引用意味着什么,也不确定将应用程序的内容作为内容有效地嵌入到这个元素中是否是正确的做法


还是有更好的方法来实现同样的目标。可能不包括内容、flash图像或登录url,只是在授权失败或完成某些我感到紧张的事情时触发两个事件中的一个,因为它不是声明性的。

我从github克隆了topeka应用程序,并在其上运行了bower安装,它带来了所有相关组件。这给了用户一个新的机会,用户一旦登录,就可以使用核心动画页面从初始启动屏幕切换到应用程序的其他部分。虽然它并没有回答我的直接问题,但它为我提供了一个很好的参考,帮助我解决一些问题。可悲的是,核心动画页面文档目前似乎已损坏