gpt4 book ai didi

JavaScript 对象构造

转载 作者:行者123 更新时间:2023-11-30 18:36:02 25 4
gpt4 key购买 nike

通常,ExtJS 组件/对象是通过将配置对象传递给它的构造函数来构造的,例如

    this.serviceFiltersPanel = new Ext.FormPanel({
title: 'some title',
layout:'anchor',
buttonAlign: 'left',
buttons: [
{
xtype: 'button',
text: 'Click Me',
handler: function () {

// How do I get a reference to the FormPanel
// under construction here?
});
}
]
});

有什么方法可以获取对从按钮处理程序内部构造的 FormPanel 对象的引用?

最佳答案

var formPanel = new Ext.FormPanel({
title: 'some title',
layout:'anchor',
buttonAlign: 'left',
buttons: [
{
xtype: 'button',
text: 'Click Me',
handler: function () {

// Q: How do I get a reference to the FormPanel
// under construction here?

// A: use the formPanel variable.
});
}
]
});

this.serviceFiltersPanel = formPanel;

关于JavaScript 对象构造,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8183488/

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