看看这个使用敲除和骨干的小提琴,这些库是自动导入的吗?
Code here :
Name: <input data-bind="value: name" type="text"/><br>
Age: <input data-bind="value: age" type="text"/><br>
Evil: <input type="checkbox" data-bind="checked: evil" /><br>
<button id="foo">Change Model!</button>
// create a plain old backbone model
var backboneModel = new Backbone.Model({
name: "Montgomery Burns",
age: 102,
evil: true
});
// use knockback.js to bridge knockout data-binding with backbone models
// read_only is set to false to make the binding two-way.
// note the use of the "kb" api for knockback.
var viewModel = kb.viewModel(backboneModel, {
read_only: false
});
// at this point, knockback has given us a viewModel which is compatible
// with the normal knockout api. so we can use the "ko" api now.
ko.applyBindings(viewModel);
$("#foo").click(function() {
backboneModel.set ({
"name": "Lisa Simpson",
"age": 8,
"evil": false
});
});
答案 0 :(得分:1)
使用左侧边栏中的管理资源功能,他们被小提琴的作者包括在内。