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