http://jsfiddle.net/descending/adNuR/2523/淘汰赛车的示例中,下拉选择信息
因此,这是淘汰赛的js汽车编辑样品和我说一两件事,获取信息的链接。当用户点击获取信息时,我需要能够添加项目并获取该行的选定项目。
我究竟可以做到这一点?我很为难
var CartLine = function() {
var self = this;
self.category = ko.observable();
self.product = ko.observable();
self.quantity = ko.observable(1);
self.subtotal = ko.computed(function() {
return self.product() ? self.product().price * parseInt("0" + self.quantity(), 10) : 0;
});
// Whenever the category changes, reset the product selection
self.category.subscribe(function() {
self.product(undefined);
});
};
谢谢这个结合
工作的例子!这是完美的 – Descending