Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
extjs中的多个覆盖_Extjs - Fatal编程技术网

extjs中的多个覆盖

extjs中的多个覆盖,extjs,Extjs,Ext JS中如何处理多个覆盖?他们是被拴住了,还是最后一个赢了?我需要决定在可能存在多个覆盖时是定义覆盖还是直接覆盖类。最后一个覆盖获胜,但在调用callParent时被覆盖的函数被链接,如下所示: 控制台中的结果: b a c C 最后一个赢了,但被覆盖的函数在调用callParent时被链接,如下所示: 控制台中的结果: b a c C Ext.define('A', { a: function() { console.log('a'); }, A:

Ext JS中如何处理多个覆盖?他们是被拴住了,还是最后一个赢了?我需要决定在可能存在多个覆盖时是定义覆盖还是直接覆盖类。

最后一个覆盖获胜,但在调用
callParent
时被覆盖的函数被链接,如下所示:

控制台中的结果:

b
a
c
C


最后一个赢了,但被覆盖的函数在调用
callParent
时被链接,如下所示:

控制台中的结果:

b
a
c
C

Ext.define('A', {
    a: function() {
        console.log('a');
    },
    A: 'A'
});
Ext.define('B', {
    override: 'A',
    a: function() {
        console.log('b');
        this.callParent(arguments);
    },
    A: 'B'
});

Ext.define('C', {
    override: 'A',
    a: function() {
        this.callParent(arguments);
        console.log('c')
    },
    A: 'C'
});

var a = Ext.create('A')
a.a();
console.log(a.A);