我有以下代码片段,用于监听由dom-repeat(Polymer 1.0.0-rc.17)创建的列表上的项目的按钮单击事件。根据polymer.dart change.log,DomRepeatModel.item is now deprecated, although it will properly use the as attribute for now. The [] operator has been added in its place
。任何人都知道如何将它应用于代码以获得相同的结果?
@reflectable
handlePurchase(event, [_]) {
print('Purchase item');
var model = new DomRepeatModel.fromEvent(event);
ShopItem item = model.item;
print(item.name);
print(item.price);
}
答案 0 :(得分:0)
找到答案,它只是模型['item']。