gpt4 book ai didi

javascript - 未捕获的类型错误 : Cannot read property 'destroy' of undefined

转载 作者:行者123 更新时间:2023-12-03 09:10:38 25 4
gpt4 key购买 nike

我是 Extjs 新手。我正在尝试销毁我的组件。

为了实现此目的,我尝试使用 getCmp 方法传递我的组件名称。我不确定如何传递 id。

这是我的组件 ID -

Ext.tab.Panel{itemId: "sportsSeenTabPanels", id:"panel-117"}

在下面提供我的代码

if (ball.Desktop.isConfigured()) {
ball.Desktop.onMainContentDestroy(function() {
Ext.getCmp('id').destroy();
});
}

以下是我收到的错误 -

Uncaught TypeError: Cannot read property 'destroy' of undefined

最佳答案

如果你制作这样的组件/面板:

Ext.create('Ext.panel',{
title: 'panel Parent',
id: 'parentID',
items: [
{
xtype: 'panel',
title: 'child panel',
id: 'childID',
itemId: 'childItemID'
}
]
});

您可以使用以下方式选择组件:Ext.getCmp('childID')Ext.getCmp('parentID').down('#childItemID');

关于javascript - 未捕获的类型错误 : Cannot read property 'destroy' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32080223/

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