[英]Polymer 1: Prevent iron-pages/app-route from attaching all pages at load
I am using Polymer 1 app-route
with iron-pages
like in the examples and starter-kit
. 我正在将Polymer 1
app-route
与示例和starter-kit
中的iron-pages
一起使用。 I find that all elements are attached on page load. 我发现所有元素都在页面加载时附加。 This causes quite abit of slow down at start.
这会在启动时造成相当大的减速。 How can I prevent this?
我该如何预防?
Polymer Staret Kit v2 which is based on the the PRPL pattern supports lazy loading of routes. 基于PRPL模式的 Polymer Staret Kit v2支持路由的延迟加载。 You can use
importHref
together with an observer on a route change to lazy load pages for iron-pages
. 您可以将
importHref
与观察者一起用于更改iron-pages
延迟加载页面的路由更改。 See here for code sample 参见此处获取代码示例
您也可以使用iron-lazy-ages ,当您更改到其端点的route
时会加载页面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.