如果ext视图路由与锚标签一起使用,则单击该链接将始终打开一个新选项卡。此强制在新标签中重新加载整个ext应用程序。有没有办法强制html中锚标签或锚将ct重定向到应用程序中的视图
{
xtype: 'component',
autoEl: {
tag: 'a',
html: 'Some Action',
href: '#someroute'
class: 'link-some-action'
},
listeners: {
click: function(){
console.warn("I AM TRAPPED");
}
}
}或
{
xtype: 'box',
html: '<a href='#someaction' class="link-some-action"> Saome Action </a>',
listeners: {
click: function(){
console.warn("I AM TRAPPED");
}
}
}如图所示,在这两种情况下,单击element都会打开一个新选项卡,从而强制再次加载应用程序
发布于 2020-03-13 21:59:12
在您的示例中,应该将监听器添加到el、here is fiddle
Ext.define('Controller', {
extend: 'Ext.app.ViewController',
alias: 'controller.mycontroller',
onElClick:function(){
console.log("I AM FREE");
this.redirectTo("test")
}
});
Ext.create('Ext.panel.Panel', {
style: "border: 1px solid red",
height: 100,
controller:"mycontroller",
title: "test",
renderTo: Ext.getBody(),
items: [{
xtype: 'component',
autoEl: {
tag: 'a',
html: 'Some Action',
href: '#someroute',
class: 'link-some-action'
},
listeners: {
el: {
click: "onElClick"
}
}
}]
})https://stackoverflow.com/questions/60670563
复制相似问题