[英]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
的頁碼 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.