gpt4 book ai didi

extjs - 如何在 ExtJS4 中为单例添加方法?

转载 作者:行者123 更新时间:2023-12-01 11:52:22 24 4
gpt4 key购买 nike

这是 ExtJS 形状类:

Ext.define('Ext.chart.Shape', {

singleton: true,

circle: function (surface, opts) {
return surface.add(Ext.apply({
type: 'circle',
x: opts.x,
y: opts.y,
stroke: null,
radius: opts.radius
}, opts));
},
...
});

我想给这个类添加一个方法。例如:

myCircle: function (surface, opts) {
return ...
},

我该怎么做?

最佳答案

我找到了答案。如果有人需要,这是解决方案:

Ext.define('MyShape', {
override: 'Ext.chart.Shape',

initialize: function() {
this.callOverridden(arguments);
},

myCircle: function (surface, opts) {
return ...
}
});

关于extjs - 如何在 ExtJS4 中为单例添加方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10242816/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com