【发布时间】:2016-07-21 11:26:43
【问题描述】:
我想在主干应用程序中使用路由导航我的嵌套视图。我有下一个代码:
var StoreRouter = Backbone.Marionette.AppRouter.extend({
appRoutes: {
'item/:name/' : 'showItem',
"item/:name/species/:speciesName/" : "showSpecies"
}
});
var StoreCtrl = Marionette.Object.extend({
showItem: function(name){
console.log("showItem");
/* execute function for show Item */
},
showSpecies: function(name, speciesName){
console.log("showSpecies");
/* execute function for show Species inside Item Layout */
}
});
所以,当路线为“item/:name/species/:speciesName/”时,我需要显示物种,但我只能触发 showSpecies 功能,而不是两者。当路由为“item/:name/species/:speciesName/”时,我应该怎么做才能触发 showItem 和 showSpecies 函数?
【问题讨论】:
标签: javascript backbone.js routes marionette nested-routes