这是示例Hello World小提琴的完整副本。我只是将它粘贴到我自己的小提琴中,并添加了对http://knockoutjs.com/downloads/knockout-3.2.0.js的引用。它适用于IE 11,但不适用于Chrome。它似乎没有解决淘汰赛参考。是否有一个或两个是Chrome专用的?jsFundle with Knockout在IE 11中工作,不在Chrome中
// Here's my data model var ViewModel = function(first, last) { this.firstName = ko.observable(first); this.lastName = ko.observable(last);
this.fullName = ko.computed(function() { // Knockout tracks dependencies automatically. It knows that fullName depends on firstName and lastName, because these get called
when evaluating fullName. return this.firstName() + " " + this.lastName(); }, this); }; ko.applyBindings(new ViewModel("Planet", "Earth")); // This makes Knockout get to work
https://jsfiddle.net/KellyWCline/rwL4rng9/2/
谢谢你的链接。我可以分配它,当我点击它时,它会进入cdnjs页面。但是,当我运行jsfiddle(更新为/ 3)时,它仍然返回两个错误:第一个是Unexpected token <位于索引文件第一行(doctype.html声明)。第二个是'未定义'。 –