我在我的应用程序中使用了 knouckout-2.2.1。它的抛出nodetype
是未定义的错误,但它在淘汰赛教程页面中工作正常。这里有什么问题?
<script type="text/javascript">
var viewModel = {
price: ko.observable(24.95)
};
viewModel.priceRating = ko.computed(function () {
return this.price() > 50 ? "expensive" : "affordable";
}, viewModel);
// Activates knockout.js
ko.applyBindings(viewModel);
</script>
<body>
The item is <span data-bind="text: viewModel.price() > 50 ? 'expensive' : 'affordable'"></span> today.
</body>
任何建议都应该不胜感激..