我正在尝试使用knockout组件绑定来自jquery移动滑块的值。但我没有那样做。有没有解决方案,除了自定义绑定? 我的js-code:
ko.components.register('slider', {
viewModel: {
createViewModel: function (componentInfo) {
$(componentInfo.element).slider("refresh");
}
},
template: { element : 'netval'}
});
var viewModel = function (value) {
var self = this;
self.value = ko.observable(value);
self.id = ko.observable("slider-new");
self.min = ko.observable(10);
self.max = ko.observable(100);
};
var Model = new viewModel(50);
ko.applyBindings(Model);