Javascript 敲除绑定不适用于jQuery Mobile
我有一个击倒和jQueryMobile的问题,和滑块。如果没有jQuery-mobile,它们工作得很好——使用jQuery-mobile,它们不会更新(就好像它们在淘汰中丢失了绑定一样) 总值标签应根据滑块位置进行更新 证明: 用jQuery Mobile.js摆弄: 不带jQuery Mobile.js的Fiddle: HTML是:Javascript 敲除绑定不适用于jQuery Mobile,javascript,jquery,jquery-mobile,knockout.js,Javascript,Jquery,Jquery Mobile,Knockout.js,我有一个击倒和jQueryMobile的问题,和滑块。如果没有jQuery-mobile,它们工作得很好——使用jQuery-mobile,它们不会更新(就好像它们在淘汰中丢失了绑定一样) 总值标签应根据滑块位置进行更新 证明: 用jQuery Mobile.js摆弄: 不带jQuery Mobile.js的Fiddle: HTML是: <p class='grandTotal'>Total value: <span data-bind='text: extrasTotal()
<p class='grandTotal'>Total value: <span data-bind='text: extrasTotal()'> </span>
<br />
<br />
<!-- ko foreach: extras -->
<label for="slider1"><span data-bind="text: description"></span> $<span data-bind="text: price"></span> each - how many would you like</label>
<br />
<input type="range" class="slide" min="0" max="10" data-bind="value: count">
<br />
<!-- /ko -->
谁能帮我解决这个问题
使用的代码是:
- jQuery 1.10.1
- jquery.mobile-1.3.2.css
- 淘汰赛-2.2.1.js
马克可能是Hi的副本-我已经试着在这个小提琴中加入答案中建议的代码:-但是,它仍然不起作用。谢谢你,马克
var Cart = function () {
var self = this;
self.extras = ko.observableArray([]);
self.extrasTotal = ko.computed(function () {
var extras = self.extras();
var total = 0;
ko.utils.arrayForEach(self.extras(), function (extra) {
var count = extra.count();
total = total + (count * extra.price);
});
return total;
});
self.extras([{
description: "Teddy bear",
price: "13.99",
count: ko.observable(0),
id: "1"
}, {
description: "Mobile phone",
price: "645.00",
count: ko.observable(0),
id: "6"
}, {
description: "Morning papers",
price: "3.00",
count: ko.observable(0),
id: "8"
}]);
};
var cart = new Cart();
ko.applyBindings(cart);