当我使用类似于custom-element的聚合物元素时,可以遍历DOM子树吗?
<polymer-element name="custom-element" attributes="something">
<template>
</template>
<script>
// access ul and li from the actual DOM here.
</script>
</polymer-element>
<body>
<custom-element something="foo">
<ul>
<li>Bar</li>
<li>Hello</li>
</ul>
</custom-element>
</body>我希望能够使用包装好的标记来参数化我的聚合物元素。
发布于 2014-11-19 14:42:30
实际上,this.children允许访问它们。
<polymer-element name="custom-element" attributes="something">
<template>
</template>
<script>
Polymer({
created: function() {
console.log(this.children);
}
});
</script>
</polymer-element>https://stackoverflow.com/questions/27016412
复制相似问题