게임용 자바 스크립트 애플리케이션을 만들고 있습니다. 목표는 MMORPG를위한 "빌드 계산기"를 만드는 것입니다. 내 응용 프로그램에 이미 저장된 데이터와보기를 동기화하려고합니다. 내가 검색 한 다른 프레임 워크를 테스트 및 녹아웃-JS는다른 객체와 데이터 바인딩 내부의 녹아웃, ViewModel
html로 저를위한 최적의 솔루션이 될 것처럼 보였다 :
<script>
var simulatorTool = new SimulatorTool();
</script>
<body>
<p data-bind="text: test"> </p>
<p data-bind="text: test2"> </p>
</body>
자바 스크립트 도구 :
function SimulatorTool()
{
meSim = this;
this.config = new Config();
this.data = new Data();
this.stuff = new Stuff();
this.traits = new Traits();
this.view = new AppViewModel();
$(function(){
ko.applyBindings(meSim.view);
});
... functions
}
보기 모델 :
function AppViewModel() {
this.test = "Test!";
this.test2 = ko.computed(function() {
return meSim.data.selectedData['profession']
}, this);
}
문제는 다른 개체의 뷰에 html을 바인딩하는 방법을 모르겠다는 것입니다. 나는 그것이 가능한지조차 모른다. 뷰는 응용 프로그램에서 분리되어 있다면 어떻게 "SimulatorTool"내부의 데이터에 액세스 할 수없는 경우에는 그
<p data-bind="simulatorTool.view, text: test"> </p>
그런 짓을하고 싶습니다?