sammyjs optional parameters

后端 未结 4 1427
-上瘾入骨i
-上瘾入骨i 2021-01-02 23:27

Just wondering if there is anyway to specify a parameter as optional in a sammy js route.

I\'ve seen somewhere that you can use

route/:foo/?:bar
         


        
4条回答
  •  無奈伤痛
    2021-01-02 23:34

    this.get('#/product/(:id)?', function(context) {
            var id = this.params['id'];
            context.app.swap('');
            context.render('templates/product.template', {base_url:base_url})
                .appendTo(context.$element()).then(function () {loadProduct();});
      });

提交回复
热议问题