2012-04-22 60 views

回答

4

router.route支持本機使用正則表達式。

initialize: function(options) { 

    // Matches /117-a/b/c/open, passing "117-a/b/c" to this.open 
    this.route(/^(.*?)\/open$/, "open"); 

}, 

open: function(id) { ... } 
+0

不應該這項工作,或者是我的正則表達式有什麼問題嗎? '[/^pages\/(.*?)[^new]$/'pages',this.pages]'''''''''''''我希望它爲頁面/ some/slugs /開頭的所有網頁使用頁面路由,但不適用於以/ new結尾的網址 – Marcus 2012-04-28 18:33:31