[英]iron-pages' selected route won't bring content
I just started trying to use Polymer through the yeoman generator. 我刚刚开始尝试通过yeoman生成器使用Polymer。 It scaffolded what seems to be the same code from polymer starter kit.
它架起了似乎与聚合物入门工具包相同的代码。
I proceeded to tweak the app/index.html to add what I need and remove what I don't, then I was trying to set up the routes I will use. 我继续调整app / index.html以添加所需的内容并删除不需要的内容,然后我尝试设置要使用的路由。 Since there was already a paper-menu with a bunch of anchors to different routes, I proceeded to copy one of them and only changed the name of my route to 'about':
由于已经有一个纸质菜单,其中有一堆锚定到不同的路线,所以我继续复制其中一个,只将路线的名称更改为“ about”:
<a data-route="users" href="/users" on-click="onDataRouteClick">
<iron-icon icon="info"></iron-icon>
<span>Users</span>
</a>
<a data-route="about" href="/about" on-click="onDataRouteClick">
<iron-icon icon="info"></iron-icon>
<span>About</span>
</a>
(first one is the already present and working, second is the copied version) (第一个是已经存在并且可以使用的,第二个是复制的版本)
Then, on the main content area, I proceeded to do the same with a section inside the iron-pages
tag: 然后,在主要内容区域,我对
iron-pages
标记内的部分进行了相同的操作:
<section data-route="users">
<paper-material elevation="1">
<h2 class="page-title">Users</h2>
<p>This is the users section</p>
<a href="/users/Rob">Rob</a>
</paper-material>
</section>
<section data-route="about">
<paper-material elevation="1">
<h2 class="page-title">About</h2>
<p>About Section</p>
</paper-material>
</section>
Same as before, I copied the existing section and replaced the data-route
value with the same value on the anchor above, 'about'. 和以前一样,我复制了现有的部分,并将
data-route
值替换为锚点“ about”上的相同值。 But when I click the About link on the left panel, there are two noticeable different behaviors: 但是,当我单击左侧面板上的“关于”链接时,有两种明显的不同行为:
Other than that I haven't touched anything. 除此之外,我什么都没碰。 Is there any other place where I should set something?
还有其他地方我应该设置东西吗? On the polymer videos that seemed to be it.
在似乎是聚合物的视频上。
Update your page.js routes (probably located at /elements/routing.html
). 更新您的page.js路由(可能位于
/elements/routing.html
)。 See the polymer-starter-kit : 参见polymer-starter-kit :
page('/about', scrollToTop, function() {
app.route = 'about';
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.