有没有在KnockoutJS中使用TypeScript的示例?我只是好奇他们是如何合作的?
编辑
这就是我所拥有的,看起来是可行的
declare var ko: any;
declare var $: any;
class ViewModel {
x = ko.observable(10);
y = ko.observable(10);
}
$(() => {
ko.applyBindings(new ViewModel());
});
这将生成以下Javascript:
var ViewModel = (function () {
function ViewModel() {
this.x = ko.observable(10);
this.y = ko.observable(10);
}
return ViewModel;
})();
$(function () {
ko.applyBindings(new ViewModel());
});
https://stackoverflow.com/questions/12689716
复制相似问题