Q是否适用于2.1版

时间:2014-05-27 06:34:19

标签: durandal durandal-2.0

Q和durandal 2.1的奇怪问题

当我按照Durandal文档中的说明操作并插入

system.defer = function (action) {
  var deferred = Q.defer();
  action.call(deferred, deferred);
  var promise = deferred.promise;
  deferred.promise = function() {
      return promise;
  };
  return deferred;
};

当我点击使用路由器的链接时,它就吓坏了:

[Q] Unhandled rejection reasons (should be empty): 
    ["TypeError: undefined is not a function↵    at Obje…lhost:9020/Scripts/knockout-2.3.0.debug.js:954:38"]
    0: "TypeError: undefined is not a function↵    
at Object.composition.executeStrategy 
(http://localhost:9020/Scripts/durandal/composition.js:593:39)↵    
at Object.composition.inject    
(http://localhost:9020/Scripts/durandal/composition.js:622:22)↵    
at Object.composition.compose (http://localhost:9020/Scripts/durandal/composition.js:681:29)↵    
at ko.bindingHandlers.router.update    (http://localhost:9020/Scripts/durandal/plugins/router.js:1122:29)↵    
at http://localhost:9020/Scripts/knockout-2.3.0.debug.js:2155:33↵    
at Object.ko.utils.objectForEach (http://localhost:9020/Scripts/knockout-2.3.0.debug.js:54:17)↵    
at ko.dependentObservable.disposeWhenNodeIsRemoved (http://localhost:9020/Scripts/knockout-2.3.0.debug.js:2151:34)↵    
at evaluateImmediate (http://localhost:9020/Scripts/knockout-2.3.0.debug.js:1270:41)↵    
at evaluatePossiblyAsync [as callback] (http://localhost:9020/Scripts/knockout-2.3.0.debug.js:1236:13)↵    
at http://localhost:9020/Scripts/knockout-2.3.0.debug.js:954:38"
    length: 1
    __proto__: Array[0]

我不确定是什么导致了这个问题,但是如果我注释掉[Q]补丁,那就完美了。这是一个durandal 2.1问题吗?

0 个答案:

没有答案