componentContainer

引用名:componentContainer

说明:容器类,当组件内调用 setContainer 时,创建一组容器示例

componentContainer.prototype

说明:在容器内添加一个组件

参数说明:

meta组件的配置数据,(即编写组件时的package.json文件以及editing.js文件数据)

data组件数据,(即将组件拖入到预览窗口后产生的数据,这部分数据由用户产生)

targetEl临时占位dom对象,在拖入预览窗口时,会有一个占位dom对象,如果没有,可传 null

opts添加的组件的控制项,具体如下:

 {
    configurable: true,/*是否可配置*/
    deletable: true,/*是否可以删除*/
    movable: true /*是否可移动*/
}

说明:通过一组组件数据,初始化容器,容器将遍历组件列表,将允许添加至容器的组件添加到容器框内


说明:遍历容器内所有组件。


说明:遍历容器内所有组件,将组件的配置数据整理为 Array 返回

示例

/*
 组件类定义。
 */
define(['jquery', 'configurableComponent'], function($, Component) {
    'use strict';

    return Component.extend({
        renderView: function() {
            this.setComponentContainer(
                this.$viewEl.find('.sub_container').toArray(), "sub-container",
                {
                    //在添加子组件之前执行,用于检查是否允许此组件被添加到子模块下。如果允许,返回true,否则返回false
                    acceptRole: function() {
                        return true;
                    }
                }
            );
        }
    });
});