2014-02-19 43 views
0

有 -Backbone.js的路由器 - 簡單的例子不工作

default.html中

<html> 
<head> 
</head> 
<body> 
    <script src="jquery-2.1.0.min.js"></script> 
    <script src="json2.min.js"></script> 
    <script src="underscore.js"></script> 
    <script src="backbone.js"></script> 
     <script> 
      Router = Backbone.Router.extend({ 
       routers: { 
        "*action" : "func" 
       }, 
       func: function (action) { 
        console.log(action); 

       } 
      }); 

      new Router(); 
      Backbone.history.start(); 
     </script> 

</body> 
</html> 

按照routers格式它具有#後打印到console後綴。

例如對於路徑default.html#hello它必須在console上打印hello,但實際上沒有打印。

這裏有什麼問題?

回答