Marionette布局内部的布局

 鬼厉--七月 发布于 2023-02-12 18:29

我有两个布局,如:

Layout1 = Marionette.Layout.extend({
  template: {
  type: 'handlebars',
  template: Layout1template
},
  regions: {
  region1: '#header',
  region2: '#content'
}

});

Layout2 = Marionette.Layout.extend({
template: {
  type: 'handlebars',
  template: Layout2template
},
  regions: {
  region1: '#contenttop',
  region2: '#contentbottom'
}

});

我想在Layout1的region2中添加Layout2.或者我想在布局中嵌套布局.任何帮助,将不胜感激.

1 个回答
  • 布局直接从ItemView扩展,因此创建嵌套布局在牵线木偶中是无缝的.

    在Layout1的onRender里面,你应该有这样的代码:

    onRender: function(){
      this.region2.show(new Layout2({
        ...//code here
      }));
    }
    

    2023-02-12 18:33 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有