簡體   English   中英

熨斗/導演中的可選參數

[英]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

johnyappleseed成為可選參數。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM