我在durandal项目工作。
我有一个问题: 在我的一个页面中,在浏览器chrome中,它没有到达compositionComplete。 (我通过调试检查了。) 在探险家 - 它来了。
原因是什么? 我该怎么检查?
答案 0 :(得分:1)
你可以像这样创建一个viewModel来检查binging:
/***==========LIFECIRCLE===============***/
var canActivate = function canActivate(view, parent) {
logger.log('Lifecycle : canActivate : Dashboard');
return true;
},
activate = function activate(view, parent) {
logger.log(viewmodel.title + ' View Activated', null, viewmodel.title, true);
return true;
},
binding = function binding(view, parent) {
logger.log('Lifecycle : binding : Dashboard');
return { cacheViews: false }; //cancels view caching for this module, allowing the triggering of the detached callback
},
bindingComplete = function bindingComplete(view, parent) {
logger.log('Lifecycle : bindingComplete : Dashboard');
},
attached = function attached(view, parent) {
logger.log('Lifecycle : attached : Dashboard');
},
compositionComplete = function compositionComplete(view, parent) {
logger.log('Lifecycle : compositionComplete : Dashboard');
},
canDeactivate = function canDeactivate(view, parent) {
logger.log('Lifecycle : canDeactivate : Dashboard');
return true;
},
deactivate = function deactivate(view, parent) {
logger.log('Lifecycle : deactivate : Dashboard');
},
detached = function detached(view, parent) {
logger.log('Lifecycle : detached : Dashboard');
};
/***==========VIEWMODEL===============***/
var viewmodel = {
title: 'Dashboard for inspection',
canActivate: canActivate,
activate: activate,
binding: binding,
bindingComplete: bindingComplete,
attached: attached,
compositionComplete: compositionComplete,
canDeactivate: canDeactivate,
deactivate: deactivate,
detached: detached
}//-->end of ViewModel
return viewmodel;