Javascript 在Polymer 1.0中使用选项卡切换视图
我想在单击某个选项卡时更改“聚合物”中的视图。为此,我想到了使用纸张标签和铁页,如中所述 这是我必须意识到的HTML:Javascript 在Polymer 1.0中使用选项卡切换视图,javascript,html,scope,polymer,Javascript,Html,Scope,Polymer,我想在单击某个选项卡时更改“聚合物”中的视图。为此,我想到了使用纸张标签和铁页,如中所述 这是我必须意识到的HTML: 试验 表1 表2 表3 {{selected}} 第1页 第2页 第3页 如果要使花括号工作,必须将元素嵌入模板[is=“dom bind”]元素中。像这样 <template is="dom-bind" id="scope"> <span>{{number}}</span> </template> ... <scr
试验
表1
表2
表3
{{selected}}
第1页
第2页
第3页
如果要使花括号工作,必须将元素嵌入模板[is=“dom bind”]
元素中。像这样
<template is="dom-bind" id="scope">
<span>{{number}}</span>
</template>
...
<script>
window.addEventListener('WebComponentsReady', function() { //You have to make sure that all custom elements are loaded
var scope = document.querySelector("template#scope");
scope.number = 1; // display the number 1
});
</script>
{{number}}
...
addEventListener('WebComponentsReady',function(){//您必须确保加载了所有自定义元素
var scope=document.querySelector(“模板范围”);
scope.number=1;//显示数字1
});
我也遇到了这个问题。找到了一个适合我的修复方法:
试试这个:
var p=document.querySelector('iron-pages');
p、 _removeListener(p.activateEvent) 非常感谢。阅读聚合物文档,我发现“is='auto-binding'”。这是从0.5开始的。这与1.0中的“Is='dom-bind'”相同吗?使用内部API方法,这只是脏的。