Navigation Sencha Touch:[警告][Ext.Component#constructor]使用已经使用过的id(`some_id`)注册组件
我有一个导航视图。单击按钮后,我试图通过调用以下函数将另一个视图推入此导航视图:Navigation Sencha Touch:[警告][Ext.Component#constructor]使用已经使用过的id(`some_id`)注册组件,navigation,sencha-touch-2,Navigation,Sencha Touch 2,我有一个导航视图。单击按钮后,我试图通过调用以下函数将另一个视图推入此导航视图: showNewView: function () { Ext.Viewport.getActiveItem().push({ title: 'New View', xtype: 'newview' }); 此newview具有一个id某些id 现在,当我多次调用此函数时,我得到以下警告: [WARN][Ext.Component#constructor] Regis
showNewView: function () {
Ext.Viewport.getActiveItem().push({
title: 'New View',
xtype: 'newview'
});
此newview具有一个id某些id
现在,当我多次调用此函数时,我得到以下警告:
[WARN][Ext.Component#constructor] Registering a component with a id (`some_id`)
which has already been used. Please ensure the existing component has been
destroyed (`Ext.Component#destroy()`.
- 我知道出现此警告是因为在第二次 调用该函数时,将使用创建一个新视图 相同的id。而id必须是唯一的。因此发出警告
- 另外,我知道我可以使用itemId而不是id,它将 用于引用该特定组件的目的
或者上述情况可以吗?我是否需要在某个时候销毁该组件?也许在流行音乐活动期间?如果是,如何调用?当您多次调用它时,您基本上创建了两个具有相同id的视图 解决方案:
if(!Ext.getCmp('newview')){
Ext.create('Org_name.Basic_name.view.newview');
}
Ext.getCmp('newview').show();