0
var Router= Backbone.Router.extend({
routes : {
"firstname/:name":"getfname",
"lastname/:lname":"getlname",
"age/:age":"getage",
"*actions":"defaultRoute"
}
})
路由器和鏈接到他們時,我想他們是
<a href="lastname/lastname>last name</a>
<a href="firstname/firstname>firstname</a>
<a href="lastname/lastname2>last name 2</a>
我怎麼做到這一點,所以當我點擊姓氏的URL會去的網址。 com/lastname/lastname,然後當我點擊名字時,它會轉到url.com/lastname/lastname/firstname/firstname,當我再次點擊第二個姓氏時,它會將URL更新爲lastname/lastname2/firstname/firstname,保留名字參數在url中。