1
我正在使用Appcelerator Studio來設計滑塊菜單。現在我需要將EventListener添加到這些滑塊菜單行中。請告訴我如何使用EventListener單擊「幫助」,以便我可以在其中提供一些條件?我的代碼如下:如何在具有行元素的數組中使用EventListener
var menuTitles = [{title : 'Home'
}, {
title : 'Help'
},{
title: 'Privacy Policy'
}, {
title : 'About Us'
}, {
title : 'Rate This App'
}, {
title : 'Logout'
}];
//Tableview
var tableView = Titanium.UI.createTableView({
data : menuTitles,
allowsSelection:true
});
menuWindow.add(tableView);
console.log(menuTitles[0]);
//console.log(tableView.data);
menuTitles[0].addEventListener('click', function(){ // It seems wrong.
alert("");
some more operation i need to perform inside this actually
});
非常感謝邁克爾檢查它。它是有幫助.. –