我正在定义一个类,但在下面的代码中尝试引用自身时遇到了麻烦。您可以看到我正在尝试起诉 push 和 pop 操作,但是 this.self.pop() 例如不是引用该类的正确方法。在类定义中引用它的正确方法是什么?
//create the navigation view and add it into the Ext.Viewport
Ext.define('myApp.view.Settings', {
extend: 'Ext.navigation.View',
id:'view',
xtype: 'navigationview',
config: {
title: 'Settings',
iconCls: 'settings',
//we only give it one item by default, which will be the only item in the 'stack' when it loads
items: [
{
//items can have titles
title: 'Navigation View',
padding: 10,
//inside this first item we are going to add a button
items: [
{
xtype: 'button',
text: 'Push another view!',
handler: function () {
//when someone taps this button, it will push another view into stack
this.self.push({
//this one also has a title
title: 'Second View',
padding: 10,
//once again, this view has one button
items: [
{
xtype: 'button',
text: 'Pop this view!',
handler: function () {
//and when you press this button, it will pop the current view (this) out of the stack
this.self.pop();
}
}
]
});
}
}
]
}
]
}
});