I have the following events for a Backbone View. Its a product view - with three tabs ("All", "Top 3", "Top 5")
Can I somehow pass a parameter into the method declaration so that it is equivalent to the following (this doesn't work)?
events : {
"click #top-all": "topProducts(1)"
"click #top-three": "topProducts(2)"
"click #top-ten": "topProducts(3)"
},
topProducts(obj){
// Do stuff based on obj value
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…