cc.Class({
    extends: cc.Component,

    properties: {
        // foo: {
        //    default: null,      // The default value will be used only when the component attaching
        //                           to a node for the first time
        //    url: cc.Texture2D,  // optional, default is typeof default
        //    serializable: true, // optional, default is true
        //    visible: true,      // optional, default is true
        //    displayName: 'Foo', // optional
        //    readonly: false,    // optional, default is false
        // },
        // ...
        testNode: { // item template to instantiate other items
            default: null,
            type: cc.Prefab,
            tooltip: "带有scrollView的节点",
        },
    },

    // use this for initialization
    onLoad: function () {

    },

    onClickShowTestNode: function() {
        if (this.testNodeLayer) {
            this.testNodeLayer.removeFromParent();
            this.testNodeLayer = undefined;
        }
        let testNode = cc.instantiate(this.testNode);
        testNode.parent = this.node;

        let ctrl = testNode.getComponent("testNode");
        ctrl.init();

        this.testNodeLayer = testNode;
    },

    // called every frame, uncomment this function to activate update callback
    // update: function (dt) {

    // },
});
