当可观察的 this.isFollowing 改变时,计算函数 this.followButtonText 怎么不更新,总是显示(Follow)?$(文档).ready(函数 () {
function AppViewModel() {
this.toggleIsFollowing = function () {
this.isFollowing = !this.isFollowing;
follow();
};
this.isFollowing = ko.observable(false);
this.followButtonText = ko.computed(function () {
return this.isFollowing ? "Unfollow" : "Follow";
});
}
ko.applyBindings(new AppViewModel());
}
});
</script>