带有铁页模型装订的聚合物纸标签
Polymer paper-tab with iron-pages model binding
如何处理纸标签的聚合物铁页内的模型。请参阅下面的代码:
<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>
所以,model.tab1.content 在 iron-pages 中不起作用。
您可以创建一个自定义元素来包装纸标签和铁页,然后所选属性的双向绑定将导致标签和页面同步。
这是 link easy-paper-tabs
的要点
如何处理纸标签的聚合物铁页内的模型。请参阅下面的代码:
<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>
所以,model.tab1.content 在 iron-pages 中不起作用。
您可以创建一个自定义元素来包装纸标签和铁页,然后所选属性的双向绑定将导致标签和页面同步。
这是 link easy-paper-tabs
的要点