Javascript 导航离开后未关闭木偶视图

Javascript 导航离开后未关闭木偶视图,javascript,backbone.js,model-view-controller,marionette,Javascript,Backbone.js,Model View Controller,Marionette,我们有几种类型的标记,但它们属于同一个数据集。我们的收藏设置与此类似 api/tags.json?category=state 我们的木偶结构如下所示: 1:Select Tag Category (LayoutView) 2:[Category:State,Type,Product,Company] Tags List (CompositeView) 3:Add / Edit [Category] Tag (ItemView) 问题是,如果我们在一个类别上处于第三或第二个

我们有几种类型的标记,但它们属于同一个数据集。我们的收藏设置与此类似

api/tags.json?category=state
我们的木偶结构如下所示:

  1:Select Tag Category (LayoutView)
   2:[Category:State,Type,Product,Company] Tags List (CompositeView)
    3:Add / Edit [Category] Tag (ItemView)
问题是,如果我们在一个类别上处于第三或第二个级别,选择第一个级别,然后导航到另一个标记类别,则上一个集合仍然存在。如果继续添加/修改,则旧模型也会保持此状态

如果有什么让我困惑,请告诉我,但我想这就是我的问题所在。如有任何提示/建议,将不胜感激

编辑:添加控制器/路由器

        DocRepoTags:function(category) {
            this.reloadHeader({'title': 'Document Repository', 'subnav': subnav(docRepoMenu)});
            App.mainRegion.destroy();
            App.mainRegion.show(new DocRepoTagsView({category:category}));
        },
        DocRepoTagsCategory:function() {
            this.reloadHeader({'title': 'Document Repository', 'subnav': subnav(docRepoMenu)});
            App.mainRegion.destroy();
            App.mainRegion.show(new DocRepoTagsCategoryView());
        },
        DocRepoTagsAdd:function(category) {
            this.reloadHeader({'title': 'Document Repository', 'subnav': subnav(docRepoMenu)});
            App.mainRegion.destroy();
            App.mainRegion.show(new DocRepoModifyTagsView({category:category}));
        },
        DocRepoTagsEdit:function(category, key) {
            this.reloadHeader({'title': 'Document Repository', 'subnav': subnav(docRepoMenu)});
            App.mainRegion.destroy();
            App.mainRegion.show(new DocRepoModifyTagsView({category:category, key:key}));
        }
下面是路线:

'doc-repo/tags': 'DocRepoTagsCategory',
'doc-repo/tags/:category': 'DocRepoTags',
'doc-repo/tags/:category/add': 'DocRepoTagsAdd',
'doc-repo/tags/:category/edit/:id': 'DocRepoTagsEdit'

ItemView(级别1)如何成为CompositeView(级别2)的父级?标高1是否应该是布局视图?此外,为了能够帮助您,您可能希望展示路由代码(即路由器和控制器)的基本工作原理。将其更改为layoutview,添加了其他代码。问题依然存在。