我有ListView中包含按钮的项目列表。我无法找到一个方法来添加事件侦听器的按钮...将事件监听器添加到ListView中的按钮 - WinJS
这是代码:
JS:
downloadsListView = document.getElementById('downloads').winControl
downloadsListView.itemDataSource = JobList.dataSource
downloadsListView.onloadingstatechanged = function() {
var _this = this;
return WinJS.Utilities.query("button.play_pause_button", document.getElementById('downloads')).forEach(function(element) {
console.log(element);
return element.onclick = _this._play_pause_download;
});
};
我可以保证,函数通过控制台输出循环按钮。但点击按钮不会触发任何事情。
我希望有人能帮忙。谢谢:)
如果您的项目中确实存在特定的交互元素,您还可以向您希望允许交互的元素添加“双赢互动” –