0

我是 extJS 的新手,我注意到了一些事情,这可能是一个愚蠢的问题,但在这里

var cntMenu = Ext.create('Ext.menu.Menu', {
    items: [{
        text:"Articles",
        iconCls: 'bmenu',
        icon:'images/menu-images/s.gif',
        handler: onItemClick,
        data:'manage-post.php'
    }]
);

生成以下代码

<a class="x-menu-item-link" href="#" hidefocus="true" unselectable="on" id="ext-gen1227">
    <img src="images/menu-images/s.gif" class="x-menu-item-icon bmenu" id="ext-gen1228">
    <span class="x-menu-item-text" id="ext-gen1229">Articles</span>
</a>

我的问题是href如何显示“#”?点击链接就像我点击一个普通的 php 链接一样。

4

1 回答 1

1

你的意思是通常的html链接吗?您的按钮不是链接。您必须在处理程序函数中添加代码并通过 javascript 方式进行导航:

onItemClick: function(button, event, opts){
    document.location.href ='your link'; // manage-post.php?
}

如果我理解正确的话。或更短:

var cntMenu = Ext.create('Ext.menu.Menu', {
    items: [{
        text:"Articles",
        iconCls: 'bmenu',
        icon:'images/menu-images/s.gif',
        handler: function(button, event, opts){
            document.location.href ='your link'; // manage-post.php?
        },
        data:'manage-post.php'
    }]
);
于 2013-10-17T11:07:57.233 回答