繁体   English   中英

我可以在Polymer中以编程方式切换铁页吗?

[英]Can I switch iron-pages programmatically in Polymer?

无论如何,如何在Polymer中以编程方式切换铁页? 我的意思是,我要在Polymer中完成操作时重定向页面。

我知道,我可以使用window.location.href进行重定向,但需要以编程方式知道聚合物中的开关铁页。

_responseChanged: function(response) {
  console.log('response', response.applicationId);

  /*
    I want to redirect page here
  */

},

以下是三种方法

  • 调用selectNext函数,它将始终选择下一页
  • 调用select功能并传递您要select的页码
  • 您也可以直接更改Iron-pages的selected属性(以下未介绍)

 <base href="https://polygit.org/components/"> <link rel="import" href="polymer/polymer.html"> <link rel="import" href="iron-pages/iron-pages.html"> <dom-module id="iron-page-select"> <template> <style></style> <iron-pages id="pages" selected="0"> <div on-tap="_selectNext">tap me to change to next page</div> <div on-tap="_selectCustom">tap me to change to 4th page</div> <div>three</div> <div>four</div> </iron-pages> </template> </dom-module> <script> Polymer({ is: 'iron-page-select', _selectNext: function() { this.$.pages.selectNext(); }, _selectCustom: function() { this.$.pages.select(3); } }) </script> <iron-page-select></iron-page-select> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM