为什么这段代码在 3 秒后没有改变?我究竟做错了什么?
<div data-bind="visible: isBusy()">
is busy
</div>
<div data-bind="visible: !isBusy()">
is not busy
</div>
var viewModel;
function AppViewModel() {
var self = this;
self.isBusy = ko.observable(true);
}
function isNotBusyAnymore() {
viewModel.isBusy = ko.observable(true);
}
viewModel = new AppViewModel();
ko.applyBindings(viewModel);
setTimeout(isNotBusyAnymore, 3000);