[英]flatiron.js routing and templating with union, director and plates?
[英]optional parameter in flatiron/director
是否可以在熨斗/導演中創建帶有可選參數的路線?
var router = Router({
'order' : function(){
// create a order
},
'order/:orderId' : function(orderId){
// load order by id
}
}).init();
我可以使用一條路線來管理編輯/加載順序嗎?
從導演文檔 :
var router = Router({
//
// given the route '/hello/world/johny/appleseed'.
//
'/hello': {
'/world/?([^\/]*)\/([^\/]*)/?': function (a, b) {
console.log(a, b);
}
}
});
基本上使用正則表達式而不是簡單的:tokens
johny
和appleseed
成為可選參數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.