Polymer 聚合物嵌套的应用程序路径映射不正确
我在试着弄对一些基本路线。我使用的是Polymer 1.5.0,使用嵌套路由时遇到问题 我正在使用应用程序route 0.9.2 正如所述,聚合物在布线中使用分散的方法。因此,我决定采取以下行动:Polymer 聚合物嵌套的应用程序路径映射不正确,polymer,polymer-1.0,Polymer,Polymer 1.0,我在试着弄对一些基本路线。我使用的是Polymer 1.5.0,使用嵌套路由时遇到问题 我正在使用应用程序route 0.9.2 正如所述,聚合物在布线中使用分散的方法。因此,我决定采取以下行动: <app-route route="{{route}}" pattern="/:page" data="{{data}}" tail="{{tail}}"> </app-route> <iron-pages selected
<app-route route="{{route}}"
pattern="/:page"
data="{{data}}"
tail="{{tail}}">
</app-route>
<iron-pages selected="{{data.page}}" attr-for-selected="title" fallback-selection="404">
<pgarena-home-app title="" route="{{tail}}" ></pgarena-home-app>
<pgarena-tournament-app title="tournament" route="{{tail}}"></pgarena-tournament-app>
<pgarena-account-app title="account" route="{{tail}}"></pgarena-account-app>
<div title="404">
<h1>{{data.page}} could not be found!</h1>
</div>
</iron-pages>
他们使用“隐藏”方法。在其中选择元素。问题是我们失去了“延迟加载优势”
有什么不对劲吗 天哪!我完全忘了。Rob Dodson强调,当使用铁选择器时,我们应该通过方括号[]
与花括号{}
的单向绑定
因此,在一天结束时,它应该是:
<iron-pages selected="[[data.action]]"
<!-- Chooses the new tournament page. -->
<app-route
route="{{route}}"
pattern="/:action"
data="{{data}}"
tail="{{tail}}"
>
</app-route>
<iron-pages selected="{{data.action}}" attr-for-selected="title" fallback-selection="404">
<pgarena-tournament-index-view title=""></pgarena-tournament-index-view>
<!-- The list of all the tournaments -->
<pgarena-tournament-list-view title="list"></pgarena-tournament-list-view>
<div title="404">
<h1>Not Found!</h1>
</div>
</iron-pages>
<iron-pages selected="[[data.action]]"
<iron-pages selected="{{data.action}}"