我尝试向一些动态创建的元素添加事件监听器,但我无法定位它们。
//here is how I try to access it
_buildTable(data)
{
this.$.spinner.style.display = 'none';
this.tableHead = Object.keys(data[0]);
this.tableData = data;
this._test();//It is called theorically after that the data has been filled
}
_test()
{
var link = this.shadowRoot.querySelectorAll(".link");
//var link = Polymer.dom(this.root).querySelectorAll(".link"); //tried this but i think it is Polymer 1.x style
//var link = document.querySelectorAll(".link"); // I tried this
console.log(link);
}
<!-- Here is the HTML dom-repeat -->
<tbody>
<template is="dom-repeat" items="{{tableData}}" as="data">
<tr>
<td class="link">{{data.id_Mission}}</td>
<td>{{data.nom}}</td>
<td>{{data.resume}}</td>
</tr>
</template>
</tbody>
祝大家有一个愉快的夜晚/夜晚/白天