Extjs merge objects

后端 未结 3 696
挽巷
挽巷 2021-02-06 05:08

I have a super class in my application, that defines an object like this:

Ext.define(\'superclass\', {
    myObject: {
        prop1: true,
        prop2: 200,
          


        
3条回答
  •  眼角桃花
    2021-02-06 05:37

    Extend the object in the constructor (or in initComponent if you extend Ext.Component):

    Ext.define('childclass', {
        extend: 'superclass',
    
        constructor: function() {
            this.myObject = Ext.apply({}, this.myObject, {
                prop3: false,
                prop4: false
            });
            this.callParent(arguments);
        }
    });
    

    Demo.

提交回复
热议问题