简体   繁体   中英

Polymer paper-tab with iron-pages model binding

How to handle model inside polymer iron-pages for paper-tab. See my code below:

<paper-tabs selected="{{selected}}">
 <paper-tab>Tab 1</paper-tab>
 <paper-tab>Tab 2</paper-tab>
</paper-tabs>
<iron-pages selected="{{selected}}">
 <div>
       {{model.tab1.content}} //not working
 </div>
 <div>
        {{model.tab2.content}} //not working
 </div>
</iron-pages>
<script>
        Polymer({
            is: "my-element",
            properties: {
                model: {
                    type: Object,
                    value: {tab1...}
                }
            }
        });
    </script>

So, model.tab1.content is not working inside iron-pages.

You can create a custom element that wraps both paper-tabs and iron-pages then the two way binding of the selected attribute will cause the tabs and pages to be in sync.

here is a link to a gist for easy-paper-tabs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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